Write a script to reverse a string without using Perl's
built in function

Answer Posted / arukumar g m

my $string="hello";
my $str;
my $i = length($string);
while($i>0) {
my $nthstr = substr($string, $i-1, 1);
$str.=$nthstr;
$i = $i-1;
}
print $str;

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the use of now constructor in perl?

522


What is the easiest way to download the contents of a URL with Perl?

557


What is the purpose of goto expr statement?

474


Write syntax to use grep function?

550


what is the function of Return Value?

561






What is the different between array and hash in perl programming?

513


What is warn function in perl?

531


how to get back up from private character editor which is saved in the format of .udf

1845


What is cpan ? What are the modules coming under this?

502


Write a cgi program to show the header part?

519


What is cpan in perl?

548


What are the features of perl language?

589


What is goto statement in perl?

510


Which operator in perl is used for the concatenation of two strings?

492


What is -> symbol in perl?

566