Shawn H Corey <shawnhco...@gmail.com> writes:

> You can use the 3-argument open for pipes:
>
>   open my $ls_fh, '-|', 'ls' or die "could not open ls pipe: $!\n";
>
>>
>> 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: $!";
>
> That's a 2-argument open; the 3-argument one looks like:
>
>   open my $fh, '<', $file or die "could not open $file: $!\n";
>
> See:
> perldoc perlopentut  http://perldoc.perl.org/perlopentut.html
> perldoc -f open  http://perldoc.perl.org/functions/open.html

I don't mean to pound this to death, but does that mean then that
there are no good uses of 2 arg opens?


Regarding perlopentut, I've been able to follow about a 1/10 of what
I've read so far, but I must say that many (of at least the early)
examples appear to be 2 arg opens.  

In fact a whole boat load of them do, but here people have seemed to
be indicating that 2 arg opens are bad, no one has shown a good use of
a two arg open in this thread.

Yet, in perlopentut, they are all over the place.


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to