use warnings; use strict; use File::Slurp; my %data; for (glob '*') { push @{ $data{$_} }, read_file($_); }