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

Answer Posted / uma from sswdept - hov service

$strin = "uma";
print "\n \$strin <$strin>";

$len = length($strin);
@arr = split(//,$strin);
print "\n \$len $len \@arr <@arr>";

for($i=$len-1;$i>=0;$i--)
{
print $arr[$i];
$retVal .= join(//,$arr[$i]);
print "\n retVal <$retVal> ";
}

Is This Answer Correct ?    3 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to close a directory in perl?

493


Explain about typeglobs?

551


What is the use of –w?

531


what is the main function of fork() in cgi programming?

545


You want to connect to sql server through perl. How would you do that?

540






Which functions in perl allows you to include a module file. State their differences.

524


What is perl push array function?

540


Can inheritance be used in perl? Explain with the help of an example.

504


What is stdin in perl?

540


How to implement a stack in Perl?

578


What is the function of cgiwrap in cgi programming?

492


how to extract pin_code,phone_number,year from text file using regular expressions in perl

1843


How to connect with sqlserver from perl and how to display database table info?

529


You want to download the contents of a url with perl. How would you do that?

503


Explain arrays in perl.

516