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
Can inheritance be used in perl? Explain with the help of an example.
How will you open a file in a write-only mode in perl?
What does next statement do in perl?
Elaborate on perl bite-wise operators.
What does localtime() do in perl?
How do I sort a hash by the hash key?
Write syntax to use grep function?
Explain chomp?
What is subroutine in perl?
What is the use of -t?
In CPAN module, name an instance you use.
We all know private variables exist in perl. But do private METHODS exist in perl ? Eg ?
What are the different ways to run cgi?
What are the functions that can be performed using cgi program?
Mention how many ways you can express string in Perl?