Simplifying slightly:
while (<DATA>) { if (/(\d+\.\d+)%/) { print $` . $1 / 100 . $'; } }
But I still prefer my s/// solution as using $` and its friends isn't recommended.
The use of this variable anywhere in a program imposes a considerable performance penalty on all regular expression matches.
"The first rule of Perl club is you do not talk about
Perl club."
-- Chip Salzenberg
In reply to Re^2: Converting percentage into number
by davorg
in thread Converting percentage into number
by uv2007
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |