#! c:\perl\bin print("Enter filename to open (text only):\n\n"); #### use strict; use warnings; #### $in=; chomp $in; if ($in !~ /\.txt$/i) { $in.=".txt"; } #### chomp(my $in=); $in .= '.txt' unless $in =~ /\.txt$/i; #### open ($in, "$in") or die("$in could not be opened:$!\n"); #### open my $infh, '<', $in or die "$in could not be opened:$!\n"; #### s/\band\b/$word/ig; while (/\band\b/ig) { ++$count; }