> (Forgive the excitement)
Not a problem. Congratulations.
> I just reversed the %n2m construct - the original builds a hash using map
> that lets you convert numbers to months, etc. (I probably found it here).
>
> In keeping with my feeling that with 'map' one can do almost anything (if
I
> knew how) I'm happy to have managed to build something using 'map'
(without
> external help I mean). Seems easy, now. ;-)
"A guy with a hammer sees all his problems as nails." --Old software saying
A) map comes from the LISP/Scheme school of programming (It's been too long,
I can't remember the name of that school). It is used to turn one list
(array) into another, basically by applying a function (procedure) to
every element in the original list.
B) You should NEVER use map in a void context. map works very hard to build
up it's return value, so there should be an assignment (=) operator to
the
left of your map call almost always, otherwise all of that work is
wasted.
Here are my recommendations to replace this line:
Yours:
map { $m2n{$_} = ++$x } qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
My foreach (also works with for instead of foreach):
foreach ('Jan','Feb','Mar','Apr','May','Jun',
'Jul','Aug','Sep','Oct','Nov','Dec') { $m2n{$_} = ++$x }
My map:
my %m2n = map {$_,++$x} qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]