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 find the length of an array in perl?
What does localtime() do in perl?
What are different data types that perl supports. Elaborate on them.
In CPAN module, name an instance you use.
What is a chomp() function in perl?
List all the features of perl programming?
List the files in current directory sorted by size ?
Explain lexical variables.
What's the difference between /^Foo/s and /^Foo/?
What package you use to create a windows services?
Mention what is cpan?
How to add elements in a hash in perl?
Why does Perl not have overloaded functions?
Mention how many ways you can express string in Perl?
What can be done for efficient parameter passing in perl? Explain.