
August 9th, 2012, 05:54 PM
|
|
Contributing User
|
|
Join Date: Jul 2012
Posts: 30
Time spent in forums: 10 h 20 m 50 sec
Reputation Power: 1
|
|
|
String not interpolating
I run this code
Code:
#!/usr/bin/perl -w
use WWW::Mechanize;
use Data::Dumper;
#$url = 'http://www.$urli.com';
&intro;
sub intro {
print " Enter: ";
&mech;
}
sub mech {
$urli = <STDIN>;
chomp($urli);
$m = WWW::Mechanize->new(autocheck => 1);
if ($urli eq 'google') {
print " 1.) News\n";
print " 2.) Images\n";
print " 3.) Quit\n";
$q1 = <STDIN>;
chomp($q1);
if ($q1 == '1') {
$url = 'http://www.google.com/news';
$m->get($url);
}
}
else {
$url = 'http://www.$urli.com';
$m->get($url);
system('firefox', $url);
}
}
and i get
Code:
Error GETing http://www.$urli.com: Can't connect to www.$urli.com:80 (Bad hostname)
the program thinks the url contains $urli when its just a variable. How do i correct this mistake?
|