foreach my $ref(@$cordinate_r) { my $line = join ' ', @$ref[0..6]; # splice field 7 into groups of four my @ary = @{$ref->[7]}; my @coord; while(@ary) { push @coord, join ' ', splice @ary, 0, 4 ; } no warnings 'uninitialized'; # see 'perldoc perlform' for what follows write; format STDOUT = @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<< $line, shift @coord ~@<<<<<<<<<<<<<<<<<<<<<<<< shift @coord . } #### G6081 yaaX 5234 5530 + 6 6 244 480 540 480 EG10011 yaaA 5683 6459 - 6 7 693 480 1010 480 10 560 469 560 EG11555 yaaJ 6529 7959 - 7 8 539 560 1010 560 10 640 969 640