in reply to Re: adapting foreach to map (why?)
in thread adapting foreach to map
I haven't tried anything on this one. It's a wierd kind of brain lock. I wrote this:
%{$matchSolutionref} = map { $CTchars[$_] => (split(//,$word))[$_] } (0..$#CTchars);
in this code and liked how it turned out. I keep trying to write something like:
%p2C = map {if (not exists $p2C{$_}) {$k=chr(ord('A')+(($a++)+$caesar) +%26); $k => $_}} (split(//, $kp))
but my fingers won't let me. Or maybe my fingers keep trying to write that and my brain won't let me.
I guess I'm enamoured of the map BLOCK LIST syntax and am trying to get away with too much code in the BLOCK part.
|
|---|