in reply to Re: my $x = <expr>; vs my $x; $x = <expr>;
in thread my $x = <expr>; vs my $x; $x = <expr>;
I'd write that as
my $x = do { open my $fh, '<', '/path/to/foo.file' or die $! <$fh>; };
Note that $fh is auto-closed due to falling out of scope.
Update: the last line was not meant to be $x = <$fh> of course.
Makeshifts last the longest.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: my $x = <expr>; vs my $x; $x = <expr>;
by Roy Johnson (Monsignor) on Jun 06, 2004 at 03:41 UTC | |
by Aristotle (Chancellor) on Jun 07, 2004 at 15:20 UTC |