while () { next if /^\s+$/; my (undef,$pos,undef) = split; print "$pos\n"; } __END__ BC001593 91 NPSL BC001593 262 NASS BC001593 293 NAST #### while () { next if /^\s+$/; my $sites = 0; if (/\w{1,12}\s+(\d{1,5})\s+[a-zA-Z]{4}/sm){$sites = $1} print "$sites\n"; } __END__ BC001593 91 NPSL BC001593 262 NASS BC001593 293 NAST