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.