Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: XP and slashes?

by ikegami (Patriarch)
on Apr 04, 2009 at 22:54 UTC ( [id://755490]=note: print w/replies, xml ) Need Help??


in reply to XP and slashes?

I determined that XP doesn't let you use forward slashes interchangeably with backward slashes

You are mistaken. Not only Perl but the actual OS supports "/" as a separator.

C:\Temp>echo foo >foo.txt C:\Temp>perl -e"open my $fh, '<', $ARGV[0] or die $!; print <$fh>;" c: +\temp\foo.txt foo C:\Temp>perl -e"open my $fh, '<', $ARGV[0] or die $!; print <$fh>;" c: +/temp/foo.txt foo

I'm on WinXP. I'm not using cygwin, however. And I don't know how cygwin sees the file system, but I quick lookaround indicates /cygwin/c/Perl/site/lib/Chess/PGN/db/ECO should work.

Replies are listed 'Best First'.
Re^2: XP and slashes?
by hsmyers (Canon) on Apr 05, 2009 at 00:16 UTC
    See answer earlier. As for being mistaken here is an example:
    C:\>cd c:/perl The system cannot find the path specified. C:\>cd c:\perl
    And while I would certainly never claim to not be mistaken early and often, I'm not about that. This only applies to the command line as near as I can tell so not relevant to my problem...

    --hsm

    "Never try to teach a pig to sing...it wastes your time and it annoys the pig."

      This only applies to the command line as near as I can tell so not relevant to my problem...

      Indeed. Your example only shows that "cd" doesn't accept "/" as a separator. You'll find the same for most of MS's command-line tools because they use "/" to mark options. However, if it's quoted...

      C:\>cd "c:/temp" C:\Temp>

      Update: Actually, it works unquoted for me too.

      C:\>cd c:/temp C:\Temp>

      Even if the slash is the first character

      C:\>cd /temp C:\Temp>
      The underlying Win32 API accepts either / or \, and has done since at lease NT 3.1, however some applications only take \. cmd.exe is one of them, of which cd is a built-in. MS-DOS and PC-DOS used to be the same (although I doubt there can be many people using the 16-bit DOS VMs any more).

        however some applications only take \. cmd.exe is one of them, of which cd is a built-in.

        I proved otherwise earlier.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://755490]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (6)
As of 2024-04-25 13:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found