local $/; # slurp the entire file local *FH; open (FH, $file_name) or die "Cannot open"; my $text = if ($text =~ /[^Total Datafile Size MB\s*][^-{22}]/s) { print "Matched\n"; }