#!/usr/bin/perl use strict; my $sql; my $line; my @words; my $tag; open (FILE, "test.txt") || "Cannot open file: $!"; while ($line = ) { print $line; chomp $line; @words = split(/\t\s*/, $line); last; } foreach $tag (@words) { print $tag."\n"; }