unless ($basename =~ /^(.{4}|.{10})_(.{10})_(.{8})_(.{6})_(.{10})_(.{8
+})\.(.{3})(\.gz)?$/) {
# ...
If the base name does not match the pattern, then abort with either of the two messages, depending on the condition on the next code line. If it does match, do what's in the else instruction.
It is equivalent (and usually slightly clearer) to turn the instructions around:
# Validate Filename Structure
if ($basename =~ /^(.{4}|.{10})_(.{10})_(.{8})_(.{6})_(.{10})_(.{8})\.
+(.{3})(\.gz)?$/) {
#
# File Name Format Fits
#
($issuercode, $outputname, $date, $time, $userid, $sequenceno, $fi
+letype) =
($1, $2, $3, $4, $5, $6, $7);
}
else {
if ((system @COPY, $filename, sprintf "%s%s%s%s", $UNHANDLED, $del
+imiter, $basename, $dupe_extn) == 0) {
abort __LINE__,"bad filename '$filename', moved to unhandled d
+irectory";
}
else {
abort __LINE__,"failed to move unhandled file '$filename'!";
}
}
|