It is important to note that DOUBLE quotes " and SINGLE quotes ' can have a very different effect in PERL.
Single quotes are literal. They will pass on exactly what is inside of them. Conents are not analyzed for variables.
EXAMPLE :
$myname="David"; print 'Hello World! My name is David'; print 'Hello World! My name is $myname'; | RESULTS :
Hello World! My name is David Hello World! My name is $myname | Double quotes are interpolated (valued or formulated). Variables will be analyzed for values.
EXAMPLE :
$myname="David"; print "Hello World! My name is David"; print "Hello World! My name is $myname"; | RESULTS :
Hello World! My name is David Hello World! My name is David |
Now as long as my name is David (which it is) then that is all there is to know about quotes. One does not check for values, and the other one does.
-----------------
Article by David Stanley. Visit his site http://www.htmlite.com. Reprinted with permission.
|