in reply to Working on hash slice

I agree that the method hippo shows here is best, but another (also non-destructive) way to initialize a hash at declaration from a pair of arrays (of equal size) is:

c:\@Work\Perl\monks>perl -wMstrict -MData::Dump -le "use List::MoreUtils qw(zip); ;; my @players = qw/ barney fred dino/; my @bowling_scores = (195, 205, 30); ;; my %score = zip @players, @bowling_scores; dd \%score; " { barney => 195, dino => 30, fred => 205 }
(Assumes initializing arrays are of equal size!) See List::MoreUtils::zip().


Give a man a fish:  <%-{-{-{-<