From: perl-win32-users-boun...@listserv.activestate.com [mailto:perl-win32-users-boun...@listserv.activestate.com] On Behalf Of Greg Aiken Sent: 20 October 2010 18:10 To: perl-win32-users@listserv.activestate.com Subject: lame question "\\\\.\\pipe\\pipename" vs '\\.\pipe\pipename'
> 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 <file:///\\\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 >From 'perldoc perldata': String literals are usually delimited by either single or double quotes. They work much like quotes in the standard Unix shells: double-quoted string literals are subject to backslash and variable substitution; single-quoted strings are not (except for \' and \\). Unless you are using the string as a command line argument, then / should work, and not need escaping. HTH -- Brian Raven Please consider the environment before printing this e-mail. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs