in reply to hmm - - - something has changed in perl (from 5.34 to 5.36
my $before; my $arg_index = 0; while ($arg_index < $#ARGV) { my $arg = $ARGV[$arg_index]; if( $arg =~ /^-B(\d+)$/ ) { # months Before $before = $1; } elsif( $arg =~ /^-B$/ ) { $before = $ARGV[++$arg_index]; if( $before !~ /^\d+/ ) { die "Bad before argument ($before)\n"; } } } continue { ++$arg_index; }
Note that the code doesn't report "Bad before" if there's no space after -B but the value is not a number.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: hmm - - - something has changed in perl (from 5.34 to 5.36
by Tux (Canon) on Nov 24, 2022 at 10:12 UTC |