Re: Perl script does not work
- From: John Bokma <john@xxxxxxxxxxxxxxx>
- Date: 29 Apr 2006 23:06:37 GMT
"A. Sinan Unur" <1usa@xxxxxxxxxxxxxxxxxxx> wrote:
While '>temp.txt' is quite safe, with "<$file", $file is interpolated.
That interpolation can have unintended effects.
My bad, I hadn't seen the OPs "<$file". I read it as: use
open my $fh, '<', $filename ...
I prefer:
open my $fh, $filename ...
Unless:
In the OP's case, there is no guarantee on what characters may appear in
the filename. In that particular case, perldoc -f open specifically
recommends the 3-argument form:
[...]
If the OP had limited the possible filenames to be processed by
filtering them in some way, I would not have made the recommendation.
Therefore, I find it better to stick with the three argument form unless
there is a specific reason to prefer the two argument form.
clear, thanks. Should have had a better peek at the OP's post, apologies.
--
John Bokma Freelance software developer
&
Experienced Perl programmer: http://castleamber.com/
.
- Follow-Ups:
- Re: Perl script does not work
- From: Bart Lateur
- Re: Perl script does not work
- References:
- Perl script does not work
- From: CSUIDL PROGRAMMEr
- Re: Perl script does not work
- From: A. Sinan Unur
- Re: Perl script does not work
- From: John Bokma
- Re: Perl script does not work
- From: Tim Hammerquist
- Re: Perl script does not work
- From: John Bokma
- Re: Perl script does not work
- From: Tim Hammerquist
- Re: Perl script does not work
- From: A. Sinan Unur
- Perl script does not work
- Prev by Date: Re: random array elements and speed
- Next by Date: Re: random array elements and speed
- Previous by thread: Re: Perl script does not work
- Next by thread: Re: Perl script does not work
- Index(es):
Relevant Pages
|