in reply to Re: How to identify invalid reg. expr.?
in thread How to identify invalid reg. expr.?
Danger! Danger! If $format contains a slash, that ends the regex and begins Perl again.my $format = "foo (bar] baz"; eval '$regex = qr/$format/;'; die "ack - $@" if $@;
I think you were trying for this:
Which won't matter if it contains slashes. Almost every code that contains string-eval is broken, and almost never necessary. {grin}my $format = "foo (bar] baz"; eval { qr/$format/ }; die "ack - $@" if $@;
-- Randal L. Schwartz, Perl hacker
|
|---|