Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Replaying Santa Claus Golf Apocalypse with Pugs/Perl6

by rg0now (Chaplain)
on Mar 12, 2005 at 17:55 UTC ( #438961=note: print w/replies, xml ) Need Help??


in reply to Replaying Santa Claus Golf Apocalypse with Pugs/Perl6

And here is my masterpiece for today, wc.p6:
say*(split"",int(7e10+ +*(=open@ARGS[0])))[1..11]
Just a quick explanation about +*(=open@ARGS[0]): the * operator forces the = $filehandle operator into list context, which is then forced into scalar context to count the number of lines in the file. Similar idea is used right after say, to force the ourput of split[] into list context without the use of join.

Update: And of course, head.p6 along similar lines:

print*(=open@ARGS[0])[0..9]

rg0now

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://438961]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2016-12-03 12:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (55 votes). Check out past polls.