Basically I’m trying to replace with whatever is returned from a function call from an object. But I need a return value from the regex search as the argument. It’s a little tricky but the code should speak for itself:
while ( $token =~ s/\$P\(([a-z0-9A-Z_]+)\)/$db->getValue("params", qw($1))/e ) { }
The error I’m getting is that $1 is not getting evaluated to anything (the argument literally becomes “$1”) so it screws up my getValue() method.
Cheers
The
qw()functions quotes “words”. I.e. it splits a string at all whitespace characters and returns that list. It does not interpolate.You can just use the variable “as is”:
The
qw()function is very different fromq(abc)(<=>'abc'),qq(abc)(<=>"abc"), andqx(abc)(<=>`abc`) orqr(abc)(<=>m/abc/):qw(a b c)<=>('a', 'b', 'c')