#/usr/bin/perl use POSIX; use warnings; use strict; use diagnostics; use Data::Dumper; #variables to hold DA values so they can be used for checks my @DA; my %rec; my @DA_head=qw(bu_name bu_start bu_end); my $bu1="passJeune100MMS,-1,1180656000,1201823940;passJeune10MMS,10,1180656000,1200441540"; my @buckets=split(';',$bu1); #add all buckets within each bucket string into array foreach (@buckets) { my ($bu_name,$bu_amount,$bu_start,$bu_end)=split(',', $_); #write the DA values into the array @rec{@DA_head} = ($bu_name,$bu_start,$bu_end); print "$_\n"; push @DA, \%rec; print Dumper(\@DA); }