in reply to Martin Brown book page 33
Actually, I get "FirstSecond2311".
The extra 1s are the return values from the functions first and second. As they don't have explicit return statements, they both return the result of the last expression evaluated. In both cases, that's a call to print. And print returns 1 (i.e. true) if it prints successfully.
For extra credit, explain why it doesn't print "23First1Second1" - which would seem to be the most obvious result.
"The first rule of Perl club is you do not talk about
Perl club."
-- Chip Salzenberg
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Martin Brown book page 33
by blazar (Canon) on May 16, 2006 at 11:19 UTC | |
|
Re^2: Martin Brown book page 33
by jhourcle (Prior) on May 16, 2006 at 15:29 UTC | |
|
Re^2: Martin Brown book page 33
by mnooning (Beadle) on May 17, 2006 at 02:37 UTC |