Write a script to reverse a string without using Perl's
built in function
Answer Posted / vipul dalwala
#!/usr/bin/perl
my $str = "hello";
$revstr = "";
while($str =~ /(.)/g)
{
$revstr = $1.$revstr;
}
print $revstr."\n";
| Is This Answer Correct ? | 12 Yes | 2 No |
Post New Answer View All Answers
What is a chomp() function in perl?
We all know private variables exist in perl. But do private METHODS exist in perl ? Eg ?
How can information be put into hashes?
What are the advantages of perl programming?
How do you give functions private variables that retain their values between calls?
What is use of ‘->’ symbol?
What is lexical variable in perl?
What package you use to create a windows services?
Explain perl. When do you use perl for programming? What are the advantages of programming in perl?
What is a perl references?
How do I sort a hash by the hash key?
How to compare two strings in perl?
How to read a directory in perl?
Difference between the variables in which chomp function work ?
What are the different string manipulation operators in perl?