in reply to Checking for data entry
That way, it's immediately obvious to the user that you expect a single parameter, which is a directory to start in, and it's obvious to someone maintaining your code exactly what you expect and where it comes from. $0 simply echos the command used to run the script.my $StartDir = shift @ARGV or die "Usage: $0 <startdir>\n";
One small bug: shift shifts from @_ by default, not @ARGV - you'll need to explictly specify @ARGV to read command line parameters.
You won't need to chomp a parameter normally, no - the newline isn't passed into the script by the shell.
Hope that helps.
-- Foxcub
#include www.liquidfusion.org.uk
Update: Struck out an (obvious) mistake, now I think about it and it's been pointed out :) (thanks, fletcher_the_dog)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Checking for data entry
by fletcher_the_dog (Friar) on Jul 08, 2003 at 19:21 UTC | |
|
Re: Re: Checking for data entry
by Anonymous Monk on Jul 08, 2003 at 15:42 UTC | |
by Albannach (Monsignor) on Jul 08, 2003 at 15:58 UTC | |
by Anonymous Monk on Jul 08, 2003 at 16:00 UTC | |
by Albannach (Monsignor) on Jul 08, 2003 at 16:09 UTC | |
by Anonymous Monk on Jul 08, 2003 at 16:40 UTC | |
by Anonymous Monk on Jul 08, 2003 at 18:06 UTC |