open my $INF, '<', 'your filename goes here' or die "Can't open file. $!"; while (<$INF>) { next unless /your regex goes here/; # at this point, you have only the lines you want, so you # can store them and do something with the data later, or # parse out the fields you want and do something, or just # reformat and print the reformatted report. }