in reply to Re: Where automatic variable $_ doesn't work?
in thread Where automatic variable $_ doesn't work?

However:

print $fh while <>;

is both shorter and clearer.

Update: Argh! that falls foul of the OP's complaint. It needs to be:

print $fh $_ while <>;

to work as intended.

Premature optimization is the root of all job security

Replies are listed 'Best First'.
Re^3: Where automatic variable $_ doesn't work?
by choroba (Cardinal) on Jul 04, 2016 at 21:12 UTC
    Although its output is quite different.

    ($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,