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 function of Return Value?

740


What is the importance of perl warnings? How do you turn them on?

750


how to create a flat file database as shown below s.no name age city phone 0 hema 22 Calcutta 4312542 1 hema 21 Bangalore 2344345 2 ganesh 25 delhi 2445454 3 kartik 45 pune 4312121 4 santosh 25 Hyderabad 2254231 5 kumar 25 mysore 2344567 6 gita 34 mangalore 6532123 7 gita 32 pune 2213456 Q1.print the details of the person who r from bangalore q2.Replace the city name managlore to pune q3.prints no of person having name gita and hema q4.print how many are of age 25.

1841


What is the use of -w, -t and strict in Perl?

752


What is a chomp() function in perl?

721


what are the three groups involved in information sharing?

654


How to convert strings into an array in perl?

702


How to get help for perl?

749


What are stdin, stdout and stderr?

683


What is a chop() function in perl?

766


What is perl pop array function?

697


How do I debug a perl program?

718


Explain the different types of data perl can handle.

676


What is the use of 'ne' operator?

681


How to create a package?

698