use strict; use warnings; use Array::Utils qw(:all); my $file = 'single.txt'; my $file1 = 'single1.txt'; my $fh; my @array; open($fh,"<",$file) or die("Could not open $file: $!"); while (my $line = <$fh>) { chomp $line; next unless $line; push(@array, split(',',$line) ); } close($fh); my @array1; open($fh,"<",$file1) or die("Could not open $file1: $!"); while (my $line = <$fh>) { chomp $line; next unless $line; push(@array1, split(',',$line) ); } close($fh);