Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^2: Where automatic variable $_ doesn't work?

by GrandFather (Saint)
on Jul 04, 2016 at 20:55 UTC ( [id://1167173]=note: print w/replies, xml ) Need Help??


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,

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1167173]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2024-03-28 22:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found