How would you replace a char in string and how do you store
the number of replacements?
Answers were Sorted based on User's Feedback
Answer / tanu
$str='Hello';
$cnt= ($str=~s/l/i/g);
print $cnt;
$cnt stores the number of replacements.
Is This Answer Correct ? | 20 Yes | 4 No |
Answer / ananth_s
#!usr/bin/perl
use strict;
use warnings;
my $string="XmanXseriesx";
my $count = ($string =~ tr/X//);
print "There are $count Xs in the string\n";
print $string;
Is This Answer Correct ? | 7 Yes | 1 No |
what is the difference b/w coldfusion MX 6 and Coldfusion MX 7?
What are arrays in perl?
Where do we require ‘chomp’ and what does it mean?
What does perl do in linux?
How do you give functions private variables that retain their values between calls?
Write a program to concatenate the $firststring and $secondstring and result of these strings should be separated by a single space.
Who created perl?
How are parameters passed to subroutines in perl?
Demonstrate subroutines in perl with a simple example.
Which functions in perl allows you to include a module file. State their differences.
What package you use to create a windows services?
Elaborate on perl bite-wise operators.