Write a script to reverse a string without using Perl's
built in function
Answer Posted / venkatesh
#!/usr/bin/perl
$a = "Venky";
@c;
@b = split("", $a);
foreach $char (@b){
unshift(@c, $char);
}
$value = join("", @c);
print "$value\n";
Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
Explain chop?
If EXPR is an arbitrary expression, what is the difference between $Foo::{EXPR} and *{"Foo::".EXPR}?
You want to open and read data files with perl. How would you do that?
What is the different between array and hash in perl programming?
Explain arrays in perl.
You want to download the contents of a url with perl. How would you do that?
what is the function of Return Value?
Which of these is a difference between Perl and C++ ?
Why to use perl?
What is the purpose of redo statement?
What does read () command do?
What are the different instances used in cgi overhead?
Distinguish my and local?
How to concatenate strings in perl?
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,