in reply to Extracting an array from a module
since it is done implicitly (and the lock removed) at subroutine return.use Fcntl ':flock'; # import LOCK_* constants sub gencli { open my $fh, '<', $gencli or die "Can't open $gencli $!"; flock ($fh, LOCK_EX) or die "Can't lock $gencli for reading: $!"; wantarray ? <$fh> : [<$fh>]; } my $gencli_ref = gencli(); # both of these my @gencli_ary = gencli(); # work
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Extracting an array from a module
by jonnyfolk (Vicar) on Oct 14, 2007 at 06:55 UTC |