$bin_file_data{$sampname} = @bindata; #### $bin_file_data{$sampname} = \@bindata; # a different way that copies @bindata as opposed # to taking a direct reference to it @{ $bin_file_data{$sampname} } = @bindata; #### # use the whole array for (@{ $bin_file_data{$sampname} }){ ... } # get a single element my $thing = $bin_file_data{$sampname}->[0];