Write a script to reverse a string without using Perl's
built in function
Answer Posted / arukumar g m
my $string="hello";
my $str;
my $i = length($string);
while($i>0) {
my $nthstr = substr($string, $i-1, 1);
$str.=$nthstr;
$i = $i-1;
}
print $str;
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
Define dynamic scoping.
What is goto statement in perl?
How do I pass a command line argument in perl?
How can I implement the function overloading in Perl ? I read about the operator overloading, I do not know how to implement the function overloading. Thanks in advance ?
What $! In perl?
Differentiate between c++ and perl.
What are the different types of perl operators?
what are the two ways to get private values inside a subroutine or block?
package MYCALC; use Exporter; our @EXPORT = (); our @ISA = qw(Exporter); our @EXPORT_OK = qw(addition multi); our %EXPORT_TAGS = (DEFAULT => [qw(&addition)],Both => [qw(&addition & +multi)]); sub addition { return $_[0] + $_[1]; } sub multi { return $_[0] * $_[1]; } 1; Program: use strict; use warnings; my @list = qw (2 2); use Module qw(:DEFAULT); print addition(@list),"\n"; Above coding is my module MYCALC and the program which using this module, I have not exported any function using @EXPORT, but I have used the DEFAULT in %EXPORT_TAGS with the function addition, when I call this function from the main it says the error as,
You want to read command-line arguements with perl. How would you do that?
“Perl regular expressions match the longest string possible”. What is the name of this match?
What can be done for efficient parameter passing in perl? Explain.
How we can navigate the xml documents?
Differentiate between arrays and list in perl.
How do I generate a list of all .html files in a directory?