# $data contains the entire contents of the input file while ($data =~ /\s+ (\d+) \s+ (\S+) \s+ (\S+) \s+ (\S+)/gx) { print "$1 $2 $3 $4\n"; }