Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Search within a variable

Thread Tools

Search within a variable

JF Potvin
Posts: n/a
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 :


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

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

$url = "";

$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 :
$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 !
Reply With Quote

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
"Variable variable name" or "variable lvalue" mfglinux Python 11 09-12-2007 03:08 AM
search within a search within a search - looking for better script times out Abby Lee ASP General 5 08-02-2004 04:01 PM
In search of elegant code: is variable is within a range??? David Filmer Perl Misc 11 12-05-2003 02:46 AM
newbie ?: expand variable within a variable Krishna Komoravolu Perl Misc 4 10-31-2003 11:43 PM