You want something like this:
#!/software/bin/perl
use warnings;
use strict;
my $file = "example.txt";
open my $in, '<', $file or die "Cannot open '$file' because: $!";
while ( <$in> ) {
next if /^#/;
chomp;
my ( $key, @fields ) = split /\t/;
print map "$key\t$_\n", @fields;
}
__END__
John
HI John,
work perfectly thanks
thanks
Nat
--
The Wellcome Trust Sanger Institute is operated by Genome Research
Limited, a charity registered in England with number 1021457 and a
company registered in England with number 2742969, whose registered
office is 215 Euston Road, London, NW1 2BE.
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/