use strict; use Data::Dumper; my @thing = qw(a c g i t); for my $id (1..5) { my (%infilestore,$seq); $seq .= @thing[rand @thing] for 0..2; push @{$infilestore{$id}}, (split //, $seq); print Dumper \%infilestore; }