Here's my take:

print 'it\'s time \\ to go';

The backslash can quote the single-quote, and hence another backslash as
well for completeness, within a single-quoted string.



On Wed, Oct 20, 2010 at 12:09 PM, Greg Aiken <gai...@visioninfosoft.com>wrote:

>  forgive my ignorance here, but I thought single quoted, or apostrophized
> [however you call this character] (‘) text strings were supposed to be
> interpreted by perl in an unaltered manner.
>
>
>
> sample code, indicating how to reference a named pipe in the Win32::Pipe
> module, shows something like this…
>
>
>
> “\\\\.\\pipe\\pipename” (note enclosed in quotes)
>
>
>
> I thought the excessive quantities of backslashes seemed silly, so I
> instead used single quotes and tried…
>
>
>
> ‘\\.\pipe\pipename’ (note enclosed in apostrophies)
>
>
>
> only to find that my client pipe program did not work.
>
>
>
> I then did a simple test print program;
>
> print ‘\\.\pipe\pipename’;
>
>
>
> and I was surprised to see what actually printed to the screen was instead;
>
> \.\pipe\pipename (note the first \ is not shown in output!)
>
>
>
> this explained why my client pipe program was working…
>
>
>
> but it left me scratching my head to ask, “why is the backslash character
> being interpreted as a special perl operator when it is found within
> apostrophies?”
>
>
>
> I thought that only happened when the backslash is found within quotes,
> such as (print “\x43”), which should print a capital C
>
>
>
> thanks in advance to anyone who can explain this to me.
>
> _______________________________________________
> Perl-Win32-Users mailing list
> Perl-Win32-Users@listserv.ActiveState.com
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>
>


-- 
Failure is not important. How you overcome it, is.
-- Nick Vujicic
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to