On Jul 18, Groove Salad said:
>sub normalize
>{
> my $file = shift;
> my $s = sprintf("%02d",$1);
> $file =~ s/^env-//;
> $file =~ s/-(\d+)/$s/;
> return $file;
>}
The $1 variable is related to the (\d+) in the regex. You can't use it as
you have, since the regex hasn't happened yet.
In retrospect, my regex had a buf -- I'd left one character out:
$file =~ s/-(\d+)/sprintf "%02d", $1/;
should have been:
$file =~ s/-(\d+)/sprintf "%02d", $1/e;
That /e modifier means to execute the RHS (right-hand side) as code. That
will make your program work properly.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun.
Are you a Monk? http://www.perlmonks.com/ http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter. Brother #734
** Manning Publications, Co, is publishing my Perl Regex book **
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]