View Single Post
  #1 (permalink)  
Old May 9th, 2011, 06:29 AM
PerlProgrammer PerlProgrammer is offline
Registered User
 
Join Date: May 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default reverse not working

Hi All,

The piece of code below doesnot print the string backwards

while(<STDIN>)
{
print "Backwards is ",reverse($_),"\n";
}

unlike this one which works

while(<STDIN>)
{
my $reverse = reverse $_;
print "Backwards is $reverse \n";
}

Why is that ,please advice?
Reply With Quote