I have written the following code to find a particular word in a doc file located on one of my drives.But I wonder if I can access a webpage (by providing its link to my code)and then I can check if a particular word exists in the webpage.Below is my code for local file on my drive.
use strict; use warnings; use diagnostics; use 5.010000; open('FILE','E:\Data.doc') or die $!; my $find; # the word to be searched print"What are you searching for ?"; chomp($find=<STDIN>); my $count=0; # It will count the word if it exists while(<FILE>){ my $string = $_; my @temp = split(' ',$string); foreach my $loop(@temp){ $count++ if($loop =~ m/$find/i);} } print"\n$find occcured $count times in your file."
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |