in reply to Re: Re: newkid confused
in thread newkid confused: reverse then unreverse a string
print implies a list context, so reverse will take the list ($foo), and reverse it to ($foo) and print that result. Probably not what is intended. It also can take a while to debug, when the perfectly acceptable-looking reverse statement "doesn't work".my $foo = "This is not a palindrome"; print reverse $foo;
Thus, if you get in the habit of being explicit about your context, you don't get caught.
|
|---|