foreach my $results (@sorted) { my @listOfItems = split( /\./, $results); if ( $listOfItems[0] =~ /literal/ ) { $listOfItems[0] = join(".", $listOfItems[0..1]); } push ( my @array1, $listOfItems[0]); push ( my @array2, $listOfItems[1]); push ( my @array3, $listOfItems[2]); # @array1 should contain the newly conjoined $listOfItems[0] # My bad ! I had some typos in my sample code. It wasnt a # cut and paste from my terminal. So my mistake guys, sorry! # This is what I was actually working with. }