Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: Replaying Santa Claus Golf Apocalypse with Pugs/Perl6

by pdcawley (Hermit)
on Mar 29, 2005 at 07:47 UTC ( [id://443062]=note: print w/replies, xml ) Need Help??


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

Can open take a block yet?
open@ARGS[0]{print..11}
or is open ... {...} a figment of my imagination?

Replies are listed 'Best First'.
Re^3: Replaying Santa Claus Golf Apocalypse with Pugs/Perl6
by rg0now (Chaplain) on Mar 29, 2005 at 09:23 UTC
    Quite a strange syntax, I think. And apparently, Pugs thinks so too, because it croaks badly when I try to run your version.

    Even though, the fact that neither Pugs nor me seem to recognize this syntax, this does not mean to any extent that it is illegal. If you can recall where you met it, I can definitely make a todo_test out of it for autrijus to implement...

    rg0now

      It's a rubyish thing: Open this and then call the block for every line of the resulting file handle, closing the file at the end. I'd not be surprised if it's a hopeful figment of my imagination.
        Open this and then call the block for every line of the resulting file handle, closing the file at the end.

        Ok, I see. How about this one?

        (=<>)[0..9].print
        This seems to work and it is semantically much closer to what you proposed: it opens the file, calls print (which is not a block, but I think, it could be made one for no good) for each requested line.

        It is an interesting question, whether we could omit the parentheses around =<>. Although Pugs does not seem to like it, I am not entirely sure that [] should bind so tight.

        rg0now

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (8)
As of 2024-04-18 07:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found