use strict; @ARGV == 1 or die "Specify a file path\n"; open(FILE, $ARGV) or die "Cannot open file: $!\n"; while (<>) { /(\S+)\s+\S+\s+(\S+)\s+(.*)/; #testing regex and tags print "$1, $2, $3\n"; #testing printing } close FILE; print "Done!\n";