i need to insert into url varible $i using perl i have probleb to do this. #!/usr/bin/perl use WWW::Mechanize; use strict; print "Content-type: text/html\n\n"; $i=1;' $websie='url/' .'$i' .' ?s=c'; print $website
You need to use double quotes if you want to interpret the value of a variable. You can use this code to insert the $i variable value into $website: print "Content-type: text/html\n\n"; $i=1; $website="url/$i?s=c"; print $website; Code (markup):
A few issues your code has: 1) You have an extra apostrophe after $i=1;' Having that ' will break your code. 2) You are settings $websie variable, but printing $website variable. Those two are different (missing the t). 3) You are placing the $i in quotes, which will translate it into string. If you want it to use a variable, remove the quotes: $websie='url/' . $i .' ?s=c'; 4) You have an extra space before the ?: $websie='url/' .'$i' .'?s=c'; Overall I would say you are starting to learn Perl, in which case you should cover the basics of the language first. You can read this ebook to increase your expertise: http://www.perl.org/books/beginning-perl/ (or google learn perl).