Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Re: Re: Re: Rebinding closures

by diotalevi (Canon)
on Dec 17, 2003 at 03:28 UTC ( [id://315210]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Re: Rebinding closures
in thread Rebinding closures

I suppose I could have written that without looping twice over grep. I had this thought of verifying that all the rules matched something since it might be considered an error condition to attempt to replace lexicals that don't exist. Then again, in a forest of indexed lists (PADLIST zero is the names, >=one is the pads, on each component of PADLIST only the index 1+ is interesting, etc) the whole thought is on doing everything indexed. The only remaining problem is that there is no guarantee that your two shifts execute in any particular order since you didn't separate the two modifications to @_ into two statements. You might get the replacement first and then the rule.

my @replacements; my @rules; for ( 0 .. $#replacement_pairs ) { push @{ $_ & 1 ? \@replacements : \@rules }, $replacement_pairs[$_]; }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2024-04-24 07:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found