On 30/03/2005, Ankur Gupta wrote: > I have the following code : > > eval{ > require "file" or die "unable to find file"; > }; > print "$@"; > > But it always prints "Can't locate file in @INC. blah blah " > > I want $@ to contain "unable to find file". What am I doing wrong or > it is not possible to override [EMAIL PROTECTED]
The require fails before you die. You will need something like this: eval { require "file"; } print "Your message" if $@ && $@ =~ m/^Can't locate file/; -- felix -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>