Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
XP is just a number
 
PerlMonks  

Re^3: when $$s =~ m/\G.../gc is too verbose (for)

by bart (Canon)
on Feb 03, 2006 at 06:15 UTC ( [id://527593]=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^2: when $$s =~ m/\G.../gc is too verbose (for)
in thread when $$s =~ m/\G.../gc is too verbose

That's why I wished Perl allowed another keyword as yet another synonym for for/foreach — I'd propose "with", for example:
with($$s) { ... }
But in the meantime, I've trained myself to actually read/see
for(SCALAR) { ... }
as
with(SCALAR) { ... }

Chalk it up as another Perl idiom.

Replies are listed 'Best First'.
Re^4: when $$s =~ m/\G.../gc is too verbose (for)
by TimToady (Parson) on Feb 03, 2006 at 14:10 UTC
    It's called "given" in Perl 6 (or in Perl6::Switch, if you want to play with 6ish topicalizers in Perl 5).

    Perl 6 also has syntactic relief for the m/\G.../gc monstrosity as well. That turns into m:p/.../, where the :p tells it to start matching at the current position. (But generally you don't even need that since subrules in a grammar always anchor to the current position anyway.)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://527593]
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.