Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Write a script to reverse a string without using Perl's
built in function

Answers were Sorted based on User's Feedback



Write a script to reverse a string without using Perl's built in function..

Answer / kiruthikau

my $i;
my $str="hello";
my @str=split('',$str);
for($i=$#str;$i>=0;$i--)
{

print $str[$i];
}

Is This Answer Correct ?    47 Yes 15 No

Write a script to reverse a string without using Perl's built in function..

Answer / 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

Write a script to reverse a string without using Perl's built in function..

Answer / kiran pawar

my $string = "kiran";

my @name = split//,$string;

while(@name){

print pop @name;

}

Is This Answer Correct ?    9 Yes 1 No

Write a script to reverse a string without using Perl's built in function..

Answer / 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

Write a script to reverse a string without using Perl's built in function..

Answer / 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

Write a script to reverse a string without using Perl's built in function..

Answer / 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

Write a script to reverse a string without using Perl's built in function..

Answer / pallavi w

#!/usr/bin/perl -w
2
3 use strict;
4 my $string = "STRING";
5 my $rev_string = join "", reverse (split ("", $string));
6
7 print "The String is ". $string ."\n";
8 print "The reverse string is ". $rev_string ."\n";

Is This Answer Correct ?    4 Yes 8 No

Write a script to reverse a string without using Perl's built in function..

Answer / go

ghw#
wled
@w
ws

Is This Answer Correct ?    5 Yes 10 No

Post New Answer

More CGI Perl Interview Questions

For a situation in programming, how can you determine that Perl is a suitable?

0 Answers  


What is hash?

0 Answers  


What are different data types that perl supports. Elaborate on them.

0 Answers  


What are the options that can be used to avoid logic errors in perl?

0 Answers  


Explain perl. When do you use perl for programming? What are the advantages of programming in perl?

0 Answers  


Show the use of sockets for the server and client side of a conversation?

0 Answers  


How do you match one letter in the current locale?

0 Answers  


How to access parameters passed to a subroutine in perl?

0 Answers  


What is the function of cgiwrap in cgi programming?

0 Answers  


What does the’$_’ symbol mean?

0 Answers  


How to concatenate strings with perl?

0 Answers  


Explain the difference between "my" and "local" variable scope declarations. ?

0 Answers   HCL,


Categories