in reply to syntax questions
While my esteemed predecessors have done a good job of answering your direct questions, perhaps I can shed some light on a few stylistic questions you didn't ask, but may still find informative.
The line:
open FILELIST, ">$filelist";is problematic for a couple of reasons:
So, instead, I would write:
(UPDATED thanks to AnomylousMonk's good catch of a very carelessly chosen variable name)
open my $fh, '>', $filelist or die "Can't open $filelist: $!";
If it fails, the program will exit with an informative error code. You could instead wrap the open call in an if statement if you want to do something else.
Purely personal preference on this next one, but your entire foreach { ... } loop could be more concisely written:
print $fh $_ for @files;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: syntax questions
by AnomalousMonk (Archbishop) on Mar 07, 2013 at 03:28 UTC |