#!/usr/bin/perl use warnings; use strict; sub read_TABLE { my ( $filename ) = @_; open( TBL, $filename ) or die "cannot open $filename: $!\n"; my @table; while ( ) { chomp; push @table, [ split( /\t/, $_ , 5 ) ]; } close TBL; return @table; } for my $row ( read_table( "TABLE.txt" )) { my ( $start, $end, $name, $strand, $type ) = @$row; print "$type\n"; }