Hi,
I tried to run a simple perl script in windows and linux.
sub ispallindrome($);
print ("enter a string");
chomp (my $string = <STDIN>);
print ("The given string is", ispallindrome($string) ? "":"not" , "a pallindrome");
sub ispallindrome($) {
my $string = $_[0];
my $l_ptr = 0;
my $r_ptr = length($string) - 1;
while (l_ptr <= r_ptr) {
my $l_char = lc substr($string, l_ptr, 1);
my $r_char = lc substr($string, r_ptr, 1);
if($l_char ne $r_char) {
return 0;}
else {
$l_ptr++;
$r_ptr++;}
}
return 1;
}
I'm getting 'out of memory' problem in windows and 'killed' problem in linux...
can somebody pls help....
thanks in advance..