Connecting Tech Pros Worldwide Forums | Help | Site Map

Search within a variable

JF Potvin
Guest
 
Posts: n/a
#1: Jul 19 '05
Hi ! I'm new to Perl and this group so any help is welcome. I've
look around the groups a lot but I can't seems to find what I need.

I have to do a script that connects to a specific web page and search
it's source code for some words. Now, the script is able to connect
to the page, print the source on screen but when I try to search, it
seems like I don't have the right parameters.

Let's look :

----------------------------------------------------
#!c:\perl\bin\perl.exe

use Win32::Internet;
$Connection = Win32::Internet->new();

print "Content-type: text/plain\n\n\n";

$url = "http://www.mydomain.com";

$INET = new Win32::Internet();
$file = $INET->FetchURL("$url");

print "Here's the web address : $url\n";
print "And here's the source code : \n\n\n$file\n\n";
----------------------------------------------------

The content of the variable $file is the source code right !
I need to do a search within the $file variable.

I tried two things I found in a book :
$canvas->find("word");
$hostindex = $text->search(-nocase, -count => \$combien, word);

It doesn't work at all when I try to print the content. I need to
know how to specify the variable in which I want the search to be
done. I don't know if you guys can understand what I mean ...


Can anybody help please ?
Thanks a lot !

Closed Thread