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
How to create a directory in perl?
What is the use of command “use strict”?
What can be done for efficient parameter passing in perl?
Why does Perl not have overloaded functions?
Which has highest precedence in between list and terms? Explain?
Show the use of sockets for the server and client side of a conversation?
What are some of the key features of objects in perl?
Explain lexical variables.
What happens in dereferencing?
What is the use of -t?
Create a function that is only available inside the scope where it is defined ?
What are the various flags/arguments that can be used while executing a perl program?
Explain the different types of data perl can handle.
How will you access an element of a perl array?
Explain cpan?