One aspect to keep in mind is that a form with two arguments is broken. Consider a file named "abc" (that is, a file name with a leading space). You cannot open the file:
open my $foo, ' abc' or die $!; open my $foo, '< abc' or die $!; open my $foo, '< abc' or die $!;
The space is deleted, so the file can no longer be found. Such a scenario is very unlikely, but definitely a problem. The tri-arg form is immune to this:
open my $foo, '<', ' abc' or die $!;
This perlmonks thread is as good as any issue. Just keep in mind that in 2001 the form with three arguments was still considered new and therefore not suitable for portable code, since Perl programs die with a syntax error if they run on the 5.005 interpreter. This is not so: perl 5.005 is not out of date, it is out of date.
dland Sep 26 '09 at 17:03 2009-09-26 17:03
source share