Go Back   Velocity Reviews > Newsgroups > PERL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

PERL - Search within a variable

 
Thread Tools Search this Thread
Old 07-17-2003, 08:42 PM   #1
Default Search within a variable


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 !


JF Potvin
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump