On Sat, 2008-10-04 at 21:26 +0200, Manfred Lotz wrote:
> my $who = "my friend";
> my $w = q(This is \n $who.);

#!/usr/bin/perl

use strict;
use warnings;

my $who = "my friend";
my $w = q(This is \n $who.);
my $text = '';

eval qq{\$text = "$w";};
die $@ if $@;

print "$text\n";

__END__

If you have `my $text = eval $w;` then $@ will contain soemthing like
'syntax error at (eval 1) line 2, at EOF'

Always check $@ immediately after eval


-- 
Just my 0.00000002 million dollars worth,
  Shawn

Linux is obsolete.
-- Andrew Tanenbaum


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


Reply via email to