my $fh = IO::File->new; *{$fh} = \ "foo"; # we'll split at foo $fh->open("< $file") or die "barf: $!"; my @ary; { local $/ = ${*{$fh}{SCALAR}}; @ary = <$fh>; }
:-)
update: a bit less ugly:
{ local $/ = $$$fh; @ary = <$fh>; }
More ugly:
You could also shoehorn a hash reference reference into the typeglob SCALAR slot to associate more stuff with it:
*{$fh} = \ { input_record_separator => "foo" }; { local $/ = $$$fh->{input_record_separator}; @ary = <$fh>; }
--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}
In reply to Re^3: IO::File is gimp.
by shmem
in thread IO::File is gimp.
by EvanCarroll
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |