use strict; use warnings; #throw away first two lines ; ; while () { chomp; next if ! defined $_ or ! length $_; my ($date, $time, $recip, $subject, $send) = /\s*([^\t]+) #date \s+([^\t]+) #time (?:\t[^\t]+){5}\s+ #Skip 5 fields (\S+) #Recipient (?:\t[^\t]+){10}\s+ #Skip 10 fields ([^\t]*)\t #subject ([^\t]*) #Sender /x; print "$date, $time, $recip, $subject, $send\n"; }