in reply to Reverse the String

Reading the docs for reverse, one sees that it will reverse a string in scalar context (

$doog = reverse('good')

results in $doog being set to 'doog'), but it will reverse the order of the elements of a list in list context (

@doog = reverse('good');

results in @doog = ('good'), as a 1 element list looks the same when reversed (Perl may even optimize the reverse away in this case).

Since print expects a list (print ($a, $b, $c) is perfectly valid Perl), Perl's behavior for

print reverse('good');

is the same as it is for

@doog = reverse('good');

emc

At that time [1909] the chief engineer was almost always the chief test pilot as well. That had the fortunate result of eliminating poor engineering early in aviation.

—Igor Sikorsky, reported in AOPA Pilot magazine February 2003.