NodeReaper has asked for the wisdom of the Perl Monks concerning the following question:

Replies are listed 'Best First'.
Re: Parsing a comma delimited file
by tachyon (Chancellor) on Feb 13, 2003 at 14:24 UTC
    perl -pi.bak -e 's/,/|/g' <file>

    cheers

    tachyon

    s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

Re: Parsing a comma delimited file
by jasonk (Parson) on Feb 13, 2003 at 14:28 UTC

    Never use backslashes in filenames, even on windows, if you change c:\doclist.chr to c:/doclist.chr and change c:\doclist.txt to c:/doclist.txt, you won't get that error (although there are many easier ways to do what you are attempting).

      Never use backslashes in filenames

      Why not? This works fine:

      $filename = "C:\\foo.txt"; # as does this $filename = 'C:\foo.txt'; # but this won't because perl thinks the \ relates to the ' $path = 'C:\some\path\'; $fullpath = $path . $filename; # however this is fine $path = "C:\\some\\path\\";

      For more on this subject see Paths in Perl

      cheers

      tachyon

      s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print