in reply to Re: Another Pattern Matching Question
in thread Another Pattern Matching Question
. Here's my code when I actually hard code the '7R', yet it still fails. + I must be missing something else? <br> <code> my ($product, $year, $month, $day, $hour, $suffix, $ver ) = spl +it /\./, $fileName; # test file name--naming convention is '<product>.<year>.<month>.<day> +.<hour>.bin' if ($fileName =~ /3B4[0|1|2]RT\.\d{10}\.\7R\.bin/) { ($product, $year, $month, $day, $hour, $ver) = ($fileName =~ /(3B4.RT)\.(\d{4})(\d\d)(\d\d)(\d\d)\.(7R\)\.bin/) +; $version = sprintf "%03d", $ver; # a little confusing, $version +is global # $ver is local } elsif ($fileName =~ /3B4\dRT\.\d\d\d\d\.\d\d\.\d\d.\d\dz\.bin/) { ($product, $year, $month, $day, $hour, $suffix) = split /\./, $fil +eName; } else { print STDERR "($0,$$) ERROR: invalid file name--'$fileName'\n" if + $opt_v; exit 2; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Another Pattern Matching Question
by kcott (Archbishop) on Oct 12, 2012 at 19:27 UTC | |
|
Re^3: Another Pattern Matching Question
by surib (Initiate) on Oct 12, 2012 at 17:43 UTC | |
by runrig (Abbot) on Oct 12, 2012 at 17:50 UTC |