Greetings, fellas.
I'm trying to write a Win32 Multiple Search script using
WWW::Search.
So I guess I'd do it like this:
#!/usr/bin/perl -w
require WWW::Search;
while ($term = <>)
{
chomp $term;
@se = ('AltaVista, Excite, Infoseek, Lycos');
foreach $se (@se)
{
$search = new WWW::Search('$se');
$search->native_query(WWW::Search::escape_query($term));
print "\n\nResults from $se :\n\n";
while ($result = $search->next_result())
{
print $result->url, "\n";
}
}
}
Well the problem here - as the experienced brothers probably already seen - it's that $se is not parsed, so it trys to run literally
$search = new WWW::Search('$se'), instead of
$search = new WWW::Search('AltaVista'), for an example.
If I try it with double quotes or no quotes at all I still receive an error.
How can I solve this? I guess it's pretty simple, but I'm stucked. My best guesses would be using
eval or
q// but I couldn't make it work with these solutions either.
TIA,
my
($author_nickname, $author_email) = ("DaWolf","erabbott\@terra.com.br")
if ($author_name eq "Er
Galvão Abbott");
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.