I didn't even know you could call a subroutine from inside a regex.
The replace expression of the substitution operator is treated as Perl code rather than a string literal when the e modifier is used.
Ref: perlop
Just to be certain, the value for the match of /(\d+.\d+)/ is $1 and is then carried into sub convert as the value $_ ?
No. A subroutine's arguments are found in @_ (no relation to $_). $_[0] (again, no relation to $_) is the first element of @_, so it's the first argument of the subroutine.
Ref: perlsub
In reply to Re^3: Crafting a regex for a split() function...
by ikegami
in thread Crafting a regex for a split() function...
by chinamox
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |