#!/usr/bin/perl -w #This Program will check to see on how many lines a word #or word fragment occurs print "Welcome to Uselessmaster 4000\n"; $op="S"; #Sets a Value to op so that there is no message about it being uninitialized until ($op =~/Q/i) { print "Would you like to (S)earch a file or (Q)uit?\n"; $op=; if ($op =~/Q/i) { print "Just hit enter to shuffle though all prompts\n"; } print "enter the word you would like to check for\n"; chomp ($word=); print "enter the full pathname of the file you would like to search\n"; $file=; open FILE, "<$file" or die "Sorry no luck opening file"; $totline=0; $occ=0; for $line () { $totline=$totline+1; if ($line =~/$word/i) {$occ=$occ+1;}; }; print "Of ",$totline," lines the word ",$word," occured on ",$occ," lines\n"; };