while () { my $line = $_; my @file; push @file, $_; # the numbers are floating point if ($line =~ /^(\d+\s+)(\d+\W?\s+)(\d+\W?\s+)/) { push @nums, $2 if $2 =~ /\d+/; push @nums2, $3 if $3 =~ /\d+/; } } my ($i, $j); print "$i\t $j\n"; #### 0.2360 0.3789 0.1879 0.3924 0.234 0.172 0.505 0.2605 0.3992 0.1560 0.4158 0.284 0.142 0.502 0.2662 0.3377 0.2025 0.4286 0.214 0.081 0.452