Hi. Let's say I have an array like this:
irb(main):008:0> letters
=> ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M",
"N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]
and another array like this:
irb(main):001:0> names = %w(simon sadie tyler kirsty kevin keith)
=> ["simon", "sadie", "tyler", "kirsty", "kevin", "keith"]
I'd like to end up with either an array or a hash that contains all
letters of the alphabet (letters) with the matching files (names) and
maybe nil for the letters with no value. I hope this makes sense.
As per the subject, this is initially wanted for the purposes of moving
files into directories. However, as FileUtils.mv happily takes an array
(or a hash?), it'd be nice to know how to do this generally.
Thanks for any assistance.
···
--
Posted via http://www.ruby-forum.com/.