If you have a bunch of hashes (could also be a bunch of arrays) that you need to define en masse and identically initialize as non-empty, something like this works:
>perl -wMstrict -MData::Dump -le "use constant HASH => qw(foo bar 1 one); ;; %$_ = HASH for \my (%hash1, %hash2); dd \%hash1; dd \%hash2; " { 1 => "one", foo => "bar" } { 1 => "one", foo => "bar" }
In reply to Re: Clear / Initialize multiple hashes
by AnomalousMonk
in thread Clear / Initialize multiple hashes
by acadey
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |