Loading ...
Sorry, an error occurred while loading the content.

Re: [PBML] relative path in windows XP

Expand Messages
  • jiqiang yao
    thanks! excellent! ... http://help.yahoo.com/help/us/groups/groups-32.htmlYahoo! ...
    Message 1 of 9 , Mar 28, 2008
    • 0 Attachment
      thanks!
      excellent!

      --- david wright <david_v_wright@...> wrote:

      > > The problem is that you're using backslashes in a
      > > double-quoted string.
      > > Backslashes are escaping characters, so "\."
      > > is really the same as ".".
      >
      > keep in mind in perl, double quotes (") interpolate
      > and single quotes do not
      >
      > in other words if written as
      > system('..\..\somefun.exe <input.txt');
      > your command would work
      >
      >
      > if you include a variable different things start to
      > happen,
      > $input = 'input.txt';
      >
      > system('..\..\somefun.exe < $input'); # does not do
      > what you want
      > system("..\..\somefun.exe < $input"); # does not do
      > what you want for the original reason
      > system("../../somefun.exe < $input"); # does do what
      > you want
      > system('..\..\somefun.exe' < $input); # does do what
      > you want
      > system('..\..\somefun.exe' < "$input"); # does do
      > what you want
      >
      >
      > you can also have a look at File::Spec, which
      > handles os/filesystem path stuff transparently
      >
      > use File::Spec;
      >
      > $path = File::Spec->catfile( @directories, $filename
      > );
      >
      > take this example:
      >
      > print File::Spec->catfile(
      > 'C:','WINDOWS','system32', 'nslookup.exe');
      > # on winxp prints C:\WINDOWS\system32\nslookup.exe
      >
      > system File::Spec->catfile(
      > 'C:','WINDOWS','system32', 'nslookup.exe');
      >
      >
      > +Dave
      >
      > --- On Thu, 3/27/08, Jeff Pinyan
      > <japhy.734@...> wrote:
      >
      > > From: Jeff Pinyan <japhy.734@...>
      > > Subject: Re: [PBML] relative path in windows XP
      > > To: perl-beginner@yahoogroups.com
      > > Date: Thursday, March 27, 2008, 9:36 AM
      > > 2008/3/27 jiqiang yao <jiqiang123@...>:
      > > > I have a script:
      > > >
      > > > #!perl -w
      > > > system("..\..\somefun.exe
      > > <input.txt");
      > > >
      > > > However, I got the warning message:
      > > >
      > > > '..' is not recognized as an internal or
      > > external
      > > > command, operable program or batch file.
      > > >
      > > > Does anyone know what i should do to fix this
      > relative
      > > > path problem?
      > >
      > > The problem is that you're using backslashes in a
      > > double-quoted string.
      > > Backslashes are escaping characters, so "\."
      > > is really the same as ".". The
      > > nice thing is, you don't NEED to use backslashes,
      > even
      > > though you're on
      > > Windows. You can simply use forwardslashes, and
      > the OS
      > > will know what to
      > > do:
      > >
      > > system "../../somefun.exe < input.txt";
      > >
      > > --
      > > [Mary said,] "Do whatever he tells you." ~ John
      > > 2:5
      > > The Cross Reference -
      > > http://thecrossreference.blogspot.com/
      > > Nos autem praedicamus Christum crucifixum (1 Cor
      > 1:23)
      > >
      > >
      > > [Non-text portions of this message have been
      > removed]
      > >
      > >
      > > ------------------------------------
      > >
      > > Unsubscribing info is here:
      > >
      >
      http://help.yahoo.com/help/us/groups/groups-32.htmlYahoo!
      > > Groups Links
      > >
      > >
      > >
      >



      ____________________________________________________________________________________
      Be a better friend, newshound, and
      know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
    Your message has been successfully submitted and would be delivered to recipients shortly.