Okay, my comments are a bit off the track of hopes' question, but they're generally in the same area. So, here they are for what they're worth:
I'm still very much in the early stages of learning Perl, so I'm not sure of the subtle details of my observations. Someone else might be able to elaborate on the causes or reasons.
Having said that, I've noticed that I can use either print "......" or print qq|.....| (I prefer bars or pipes) without a problem, with the exceptions sited by others above regarding the considerations of using double-quotes within the double-quotes associated with the print statement.
However, when I use the CGI module with the following line within my code:
my $q = new CGI;
I've noticed that I cannot be sloppy about my use of single-quotes and double-quotes, as I might otherwise. Meaning, single and double quotes are no longer interchangeable. The following line of code, as an example, is sensitive to quote choice when adding the line about "new CGI" mentioned above:
print $q->start_form(-method=>'post', -action=>"order_form.cgi?ord_id=$ord_id")
The action reference to the cgi script has to be in double-quotes or the value of $ord_id won't come through; it will be passed as a literal value. I'm not sure why the "new CGI" line causes this. Just using the CGI module doesn't cause things to be so strict. And, I don't think it's because of the commands I happen to be using, because there are some commands that I can use with the CGI module and not the "new CGI" statement (i.e., print "Location: order_form.cgi?ord_id=$ord_id \n\n" must be within double-quotes with "new CGI").
In reply to Re: Differences between qq() and ""
by Spenser
in thread Differences between qq() and ""
by hopes
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |