Your expression:
my ($id) = /(\d+)$/ || /^(\d+)/;
will not work correctly because the first regular expression is evaluated in scalar context and so will return 1 when it matches and not the id number.
This will do what you want:
my $id = ( /(\d+)$/ )[ 0 ] || ( /^(\d+)/ )[ 0 ];
Or this:
my $id = /(\d+)$/ ? $1 : /^(\d+)/ ? $1 : ();
In reply to Re: Win32 File Creation Weirdness, ActivePerl 5.8.8
by jwkrahn
in thread Win32 File Creation Weirdness, ActivePerl 5.8.8
by missingthepoint
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |