"Randy W. Sims" wrote:

> On 2/11/2004 9:23 AM, Wiggins d Anconia wrote:
>
> > Actually we can emphasize that 'need' a bit to a 'cannot'.  'use' *must*
> > take a bareword.
>
> unless it's in an eval ;-)
>
> perl -Mstrict -we "my $m='Cwd';eval qq(use $m);print cwd();"

Not really.  In the example above, the module name is not quoted.  The string
constant to be substituted into the eval'ed expression is quoted:
my $m='Cwd'
as is necessay for a string assignment to a scalar.
The expression as a whole is double-quoted, as is required for nterpolated
strings offered for evaluation.
eval qq(use $m);
The module name, though, is not separately quoted.  This is actually a simple
misuse of eval in void context for its side effects .The actual use statement
that gets processed is not quoted in any way.

Joseph


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to