#!/usr/bin/perl #use strict; use warnings; use Data::Dumper; my @records; my @col; my ($probe, $x_coord, $y_coord, $mils, $micron); my $infile= 'coord.txt'; open (DATA,'<',$infile) or die "could not open the $infile: $!"; while () { chomp; my @col = split " ", $_; push @records, \@col; } #print Dumper(\@col, @records); for (\@col){ print join("\t",$col{$records[0]}, $col{$records[1]}, $col{$records[2]}, $col{$records[3]}); } #this for loop doesn't work