Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I am busy converting a perl script into a CGI.. this snippet of perl code works fine;
open (FILE, $ARGV[0]) or die "unable to open file $!"; my $data = do {local $/; <FILE>; }; print $data;
So why doesn't this CGI alternative snippet not work??
$file_contents = $query->param('file'); $file_contents =~ m/^.*(\\|/\)(.*)/; my $name = $2; open (FILE, ">$name") or die $!; my $data = do {local $/; <FILE>; }; print STDOUT $data;
thanks monks