On Fri, Mar 31, 2006 at 05:41:32AM -0800, Steve Thames wrote:
> Consider this:
> 
>       my %names = (Bob => 'Robert Brower');
>       my $caption = 'Name: $names{Bob)';
>       print  eval "qq|$caption|";
[...]
> Does anyone have any idea how to capture the syntax error in a case
> like this?


You mean something like...

  my %names = (Bob => 'Robert Brower');
  my $caption = 'Name: $names{Bob)';
  print  eval "qq|$caption|";
  die $@ if $@

giving:

  syntax error at (eval 1) line 1, near "Bob)"
  Missing right curly or square bracket at (eval 1) line 1, within string

HTH
-- tomas

Attachment: signature.asc
Description: Digital signature

Reply via email to