Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: use of useless void in context

by JavaFan (Canon)
on Feb 07, 2009 at 17:36 UTC ( [id://742141]=note: print w/replies, xml ) Need Help??


in reply to use of useless void in context

$content =~ s/(\$[a-zA-Z0-9\{\'\}_]+)/ eval($1) /ge if $1;
The '$1' after the if would refer to the $1 set by the last successful match. Also, if you want to eval the content of $1, no need to do both eval($1) and /e. Just /e should do.
$content =~ s/(\$[a-zA-Z0-9\{\'\}_]+)/ if $1(eval($1)) /ge;
That doesn't make any sense.

Since you don't tell us what you try to do, I won't bother offering suggestions.

Replies are listed 'Best First'.
Re^2: use of useless void in context
by romandas (Pilgrim) on Feb 09, 2009 at 10:58 UTC
    I agree. From what I can tell, the OP could use a backreference instead ( \1, \2, etc ), but I can't quite puzzle out what the OP is trying to accomplish.
      Considering the OP is using all his backreferences outside of the pattern itself, I don't see where the OP should use a \1 instead of a $1.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2024-04-20 15:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found