dpatrick has asked for the wisdom of the Perl Monks concerning the following question:
Fellow Monks,
I humbly bring before you a piece of code that I have been looking at for about the past hour:
What I'm trying to do is interpolate $f into $fromQuery::$f so that we end up with $fromQuery:foo if $fromQuery::foo exists. Does anyone know how this could best be handled?
As an aside, the fromQuery namespace comes from the CGI::import_names object method but that's not really that important.
dpatrick
- I think scsh is cool.
Open Sourceror, Perlmonk
http://perlmonk.org/~dpatrick
foreach my $f (@fields) { push(@where, qq($f='$fromQuery::{ $f }')) if $fromQuery::{ $f }; push(@searchString, qq($f=).escape($fromQuery::{ $f })) if $fromQuery::{ $f }; }
What I'm trying to do is interpolate $f into $fromQuery::$f so that we end up with $fromQuery:foo if $fromQuery::foo exists. Does anyone know how this could best be handled?
As an aside, the fromQuery namespace comes from the CGI::import_names object method but that's not really that important.
dpatrick
- I think scsh is cool.
Open Sourceror, Perlmonk
http://perlmonk.org/~dpatrick
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Variable Interpolation Interpolation
by broquaint (Abbot) on Mar 20, 2002 at 19:28 UTC | |
Re: Variable Interpolation Interpolation
by dragonchild (Archbishop) on Mar 20, 2002 at 19:15 UTC | |
by dpatrick (Scribe) on Mar 20, 2002 at 19:20 UTC | |
by dragonchild (Archbishop) on Mar 20, 2002 at 19:30 UTC | |
Re: Variable Interpolation Interpolation
by knobunc (Pilgrim) on Mar 20, 2002 at 19:42 UTC |
Back to
Seekers of Perl Wisdom