Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Re: Question of variable interpolation in regex

by thelenm (Vicar)
on Nov 15, 2002 at 16:56 UTC ( [id://213202]=note: print w/replies, xml ) Need Help??


in reply to Re: Question of variable interpolation in regex
in thread Question of variable interpolation in regex

Actually, the left-hand side of the substitution (the regex) is the part that is only compiled once. The right-hand side will change as $string changes. Try this:
my $foo = 'a'; for my $string ('b'..'z') { $foo =~ s/./$string/o; print "$foo\n"; }

-- Mike

--
just,my${.02}

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2024-04-19 11:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found