In such case, you have to know where the end is to determine, where the last `_' is...
I'll assume that the filename ends with .pdf:
if ($filename =~ /^(.*)_(.*)\.pdf$/) { # do something with $1 and $2 here }
Because of the Perl "longest-first" matching, the underscore will match the last underscore in the filename.
In reply to Re^3: Pattern Matching in Arrays
by przemo
in thread Pattern Matching in Arrays
by aj.kohler
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |