#!/usr/bin/perl -w use strict; my @Fields; my @Array; open (FILE,"file") or die "Can't open file\n"; while () { next if (/^#/); @fields = split "\t" , $_; next unless (@Fields == 7); push @Array , [ @Fields[0,3,6] ]; } foreach my $foo (@fields) { print "$foo->[2]\n" if ($foo->[2] != 3); }