http://qs321.pair.com?node_id=219608


in reply to perl + CGI's

$file_contents =~ m/^.*(\\|/\)(.*)/; my $name = $2;
Never ever use $1 or $2 unless it's in the context of having tested whether the match worked or not.

Since that match could fail, you have no idea what's in $2 at this point. Could be from a previous match.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.