in reply to what is the return value
To proove that the code does not do what's stated here, try this:
use strict; use warnings; open my $in, '<', "a"; print firstline("b"); sub firstline { open (my $in, shift) && return scalar <$in>; # no close() required }
If the descriptions here were right, you should get "from b" but you will get "from a".
The reason is that "<$in>" is referring to the outer $in.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: what is the return value
by MidLifeXis (Monsignor) on Jul 09, 2013 at 14:42 UTC | |
|
Re^2: what is the return value
by fishmonger (Chaplain) on Jul 09, 2013 at 14:42 UTC | |
|
Re^2: what is the return value
by ww (Archbishop) on Jul 09, 2013 at 15:14 UTC |