| [reply] |
I really like freakOut and exit unless scalar @ARGV >= 4;
I'm such a bonehead I thought you had typo'ed and left
the pound off the front of a comment =)
And the "scalar" part isn't needed. The >= comparator
does that for ya.
--
$you = new YOU;
honk() if $you->love(perl) | [reply] [d/l] |
| [reply] [d/l] |
I know now that using File::Find would be better but I didn't know that when I wrote it so I used the right-tool-for-the-job ;-)
I changed the code to check the result of the opendir, would it have caused problems otherwise?
Why not shift it twice? Isn't that way faster than a grep?
A shift would just ++ the array's base pointer (in C) so it sounds logical to me to use this over grep, right?
| [reply] |
Yes, two perlfunc:shifts or a perlfunc:splice would be faster than grep,
if you can absolutely always rely on . and .. being the first
two items listed in a directory. Which you probably can't even if that is the case
on your system.
A false return on opendir means that the system had a
reason why it couldn't read what was in the directory (probably
no read permission for user, you can find out in $!). This means that the call to readdir
would fail (I think it would be fatal under warnings and strict)
or if the program tried to keep on going @fools would be empty, causing other problems.
| [reply] [d/l] |