Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Answer: How do I assign & substitute in one statement?

( #407637=categorized answer: print w/ replies, xml ) Need Help??

Q&A > strings > How do I assign & substitute in one statement? contributed by Roy Johnson

Predicate-for allows you to declare and modify a lexical in the same statement:
s[http://foo.bar.com/][] for (my $dirfilename = $url);
Using block-for does not put the lexical in the surrounding scope. This is an interesting difference, particularly since -MO=Deparse indicates that the above statement is translated into the block form.

Comment on Answer: How do I assign & substitute in one statement?
Select or Download Code
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2015-07-05 09:18 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 (61 votes), past polls