in reply to Re^2: my $x = <expr>; vs my $x; $x = <expr>;
in thread my $x = <expr>; vs my $x; $x = <expr>;

You can't use $x in the same statement as you declare it. Your second use of $x is global. The last line in the block should be just scalar <$fh>

The PerlMonk tr/// Advocate

Replies are listed 'Best First'.
Re^4: my $x = <expr>; vs my $x; $x = <expr>;
by Aristotle (Chancellor) on Jun 07, 2004 at 15:20 UTC
    That was just a mistake. Thanks for catching it. scalar is not necessary here, btw, because my $x = already provides scalar context.

    Makeshifts last the longest.