#!/usr/bin/perl -w use strict; #This Program will check to see on how many lines a word or word fragment occurs print "Welcome to Uselessmaster 4000\n"; my($totline,$op,$word,$file,$occ,$line); $op="S"; #Sets a Value to op so that there is no message about it being uninitialized until ($op =~/Q/i) { 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++; if ($line =~/$word/i) {$occ++;}; }; print "Of ",$totline," lines the word ",$word," occured on ",$occ," lines\n"; print "which is is ",$occ/$totline*100,"% of the lines\n\n"; print "Would you like to (S)earch another file or (Q)uit?\n"; $op=; };