On Thursday 02 May 2013 12:07:28 Shmuel Fomberg wrote:
> ...
> print qq'h\\ello\ \{world\}', "\n";
> 
> It appear that double quote and qq respect any slash, no matter what is
> after it.
> single-quote and q respect only slashes that are before the quoting marks
> and another slash.
> 
> Amusing.

Actually its very strait forward if we phrase those rules a bit differently:
     *  The qq operator is synonym to double quotes
     *  The q operator is synonym to single quotes
     *  Inside double quotes perl interpolates: variables and special sequences 
("\n", "\"", 
etc)
     *  Inside single quotes perl does not interpolates (e.g: a " is not 
special inside single 
quotes).
The only special sequences inside single quotes are:
     *  Backslash-single-quote: otherwise there was no way to insert single 
quote 
character into a single quoted string (no interpolation...)
     *  Backslash-backslash: otherwise you could not insert a backslash as the 
last 
character in the string (the previous rule would apply -- \' )
Enjoy,

-- 
Oron Peled                                 Voice: +972-4-8228492
o...@actcom.co.il                  http://users.actcom.co.il/~oron
"I love deadlines, especially the whooshing sound they make as they go by." 
      -- Douglas Adams

_______________________________________________
Perl mailing list
Perl@perl.org.il
http://mail.perl.org.il/mailman/listinfo/perl

Reply via email to