in reply to Re: getting files from Dir
in thread getting files from Dir
As an aside to this, if you are using ||, make sure you've got the parentheses around the arguments passed to opendir. Otherwise you'll be testing for the value of $somedir and dying if $somedir is an empty or undefined scalar. Better yet, just use 'or', so that your test on the success of opening the directory will do what you are expected, whether or not the parentheses are present:
opendir DIR, $somedir or die "Could not open '$somedir': $!";
Also, if your script is going to be extremely long, you might want to exclude the newline (\n) at the end of your die statement, to make debugging easier (ie: knowing which line in your program died on you. In this case however, it seems to be a short script, so you'll probably know where the problem is. :)
"User error. Replace user and press any key to continue."
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re^2: getting files from Dir
by vek (Prior) on Jan 25, 2003 at 15:49 UTC |