in reply to Bug in 'strict'??

I don't know if it is a bug in strict or not but you need to check to make sure that the match works before assigning $2 to anything. If the match fails then $localfilename will be empty and the open will fail.

Something like

my $localfilename; if($filename =~ m/(.*?$CGI::SL)*(.*)(?=$)/ ) { $localfilename = $2; } else { # handle the error however you need to }

Replies are listed 'Best First'.
Re: Re: Bug in 'strict'??
by Jouke (Curate) on Apr 05, 2001 at 16:56 UTC
    You're right modred (I could have predicted these replies of course), but it does match. That's not even the case. $localfilename gets a value from $2. Take that as true, but just by calling open() the value disappears.

    Jouke Visser, Perl 'Adept'