SPUG: Eval Question
Richard A. Puckett II
puckett at nwlink.com
Tue Oct 12 11:40:38 CDT 1999
Asim Jalis wrote:
>
> Why doesn't this work?
>
> #!/usr/bin/perl
>
> my $y ;
Replace:
my $x = "$y = &length(q{hello world});" ;
with
my $x = '$y = length(q{hello world});';
Want to use single quotes here so variables aren't "interpolated".
Also want to ditch the ampersand on "length". FYI, you can check
$@ after the eval for possible errors.
- Richard.
> eval $x ;
> print "[$y]\n" ;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe
Email to majordomo at pm.org: ACTION spug-list your_address
More information about the spug-list
mailing list