in reply to Re: Re: Aging Script
in thread Aging Script
the 1st if statement here says if the user uses -h appended to the end of the script file, die an tell them how to run the command properly.
the second part says: if it is not a number, die, otherwise set $agedays to $opt_d (the value of -d).
Normally, I would run agecmd.pl -d90
By switching the two, you have made the d option the help option, and made the -h option the number of days. By not specifying -d, $agedays is then set to 60 by default, giving you no problems.
By taking things out, and changing the code, it's hard to know what happened. Does you have problems if you run the original code with no mods? Can you post your new code?
if ($opt_h){ die "\agecmd.pl -d[days to age]\n"; } if ($opt_d){ if ($opt_d gt 9){ #tests for strings die "Error: days option must be a number. Use agecmd.pl -d[da +ys to age]\n"; }else{ $agedays=$opt_d; } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Re: Re: Aging Script
by Seema (Novice) on Aug 10, 2001 at 22:25 UTC | |
by OzzyOsbourne (Chaplain) on Aug 10, 2001 at 22:34 UTC | |
by Seema (Novice) on Aug 11, 2001 at 01:14 UTC | |
by OzzyOsbourne (Chaplain) on Aug 14, 2001 at 15:41 UTC |
In Section
Seekers of Perl Wisdom