Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
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 rifling through the Monastery: (6)
As of 2017-04-24 17:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (443 votes). Check out past polls.