in reply to Re^2: a simple exercise in readability
in thread a simple exercise in readability
Secondly, instead of:
HELP_MESSAGE() and exit unless $ARGV[1]; foreach (@ARGV) { HELP_MESSAGE() and exit unless /^-?\d+$/ } # ... and later ... sub HELP_MESSAGE { print $help; }
why not just do the following, which is (I think) more clear, takes less space, and is more precise in the case of invalid input ...
die $help unless $ARGV[1]; map { /^-?\d+$/ or die "Invalid input $_\n" } @ARGV;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: a simple exercise in readability
by apotheon (Deacon) on Jan 15, 2007 at 15:40 UTC | |
by johngg (Canon) on Jan 15, 2007 at 16:57 UTC | |
by apotheon (Deacon) on Jan 15, 2007 at 17:08 UTC |