open (READFILE, $filename)|| die "Failed to open $filename: $!"; my $filecontents; { local undef $/; $filecontents = ; } close ; my @words = $filecontents =~ / ... /g; my $wordcount = scalar @words; my @characters = ... my @sentences = ... # etc