|Just another Perl shrine|
map and regexp. An newbie questionby nando (Acolyte)
|on Oct 19, 2011 at 06:37 UTC||Need Help??|
nando has asked for the
wisdom of the Perl Monks concerning the following question:
I am learning to use the "map". Naturally I have been some question. For example:
Here $ _ * 2 does not modify $ _ and the result is as expected:
33 .... 66
Instead, working with regexp $ _ variable itself is modified:
And the result is not
Where the %cosa key appears modified by ~ s and receives the number of substitutions made as value. It is also logical.
How do I use regexp and map if I want to have as a key each word in the array and assign it as value the result of a regexp operation on this key?