Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
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


Comment on Re: Replaying Santa Claus Golf Apocalypse with Pugs/Perl6
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (9)
As of 2015-07-02 05:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (29 votes), past polls