SPUG: using ActivePerl coming from UNIX land

David Innes (CSG) davidinnes at chicagoscience.com
Thu Dec 23 02:16:46 CST 2004


Tim asked:
Is the abilitye to use the "wrong slash-angle" an ActivePerl enhancement or
a standard Perl feature?

And Mark Schul said:
I think this derives from M$ C, as path names in C could use forward
slashes (although it has been a while since I had anything to do with that
platform/language combination).  There must some interesting parsing rules
to allow filenames - in C - to include embedded backslashes...

I say:
Hmm.  After Googling around a bit it looks like...

a) You have to escape backslashes in pathnames in C (e.g. "c:\\tmp"), or ...

b) Evidently, going as far back as MS-DOS, you can forward slashes in system
function calls (e.g. "c:/tmp").  Backslashes are required only on the
command line itself.  You still run into that with Perl's System() function.
It chokes if you try something like system("c:/test.bat").  You have to use
system("c:\\test.bat") or system('c:\test.bat')instead.  So...

c) ActivePerl may just inherit the functionality from C and/or the
underlying OS.

In other words C is still C under Windows but at least the OS is smart
enough to recognize forward slashes in system calls.  (Everyone who agrees
this is dumb should take a minute to ritually curse IBM.  They could have
adopted Microsoft's fully-functional, already commercially-released Unix
operating system for the original PC.  Instead IBM asked for a brand-new
16-bit OS -- in a hurry -- and told Microsoft not to bother implementing
subdirectories because "we're only going to sell a few thousand of these
things and anyone who wants useful things like subdirectories will buy one
of our 'real' computers."  Of course if IBM *had* done the smart thing
everyone would be grousing about Gates for making it hard to switch from
Unix to TorvolDOS. :-))

		-- David Innes




The information contained in this e-mail message may be privileged, confidential, and protected from disclosure. If you are not the intended recipient, any further disclosure or use, dissemination, distribution, or copying of this message or any attachment is strictly prohibited. If you think that you have received this e-mail message in error, please delete it and notify the sender.


More information about the spug-list mailing list