open my $fh, "<", "File/name" or die "Could not open file:$!"; $/=""; while (my $doc = <$fh>){ # Process, or search through contents of $doc.... } close $fh;