Philip Potter <philip.g.pot...@gmail.com> writes: > The three argument form: > > open my $fh, '<', 'rm -rf ~ |' or die "could not open rm -rf ~ |: $!"; > > doesn't have this problem. It will try to open a file with quite a > funny name, but because the mode is chosen my the second argument and > not by a user-supplied string, the user can't execute arbitrary code
Still a bit confused here. If you want an open with a pipe char for actual piping then the 2 arg is good? But if so then all the problems discussed here come into play again. It seems like the redirect operator inclusion is what makes the open safer. So is this a 3 or 2 arg open: my $file = './file'; open(my $fh,"<$file")or die "Can't open $file: $!"; -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/