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
You want to print the contents of an entire array. How would you do that?
Can we load binary extension dynamically?
Explain use of ‘my’ keyword in perl?
How will you create a file in perl?
What is the purpose of _package_ literal?
Perl uses single or double quotes to surround a zero or more characters. Are the single(' ') or double quotes (" ") identical?
What are arrays in perl?
Show the use of sockets for the server and client side of a conversation?
How to access parameters passed to a subroutine in perl?
What does next statement do in perl?
Write a program to concatenate the $firststring and $secondstring and result of these strings should be separated by a single space.
Explain the various characteristics of perl.
What does read () command do?
Mention the difference between die and exit in Perl?
What is the closure in PERL?