Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
Problems? Is your data what you think it is?
 
PerlMonks  

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

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

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


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 04: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
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.