in reply to Re: problem opening file
in thread problem opening file

And it's also good practice to include the filename you're attempting to open in the message as well so you know what you were trying to monkey with as well as why exactly it failed.

(And a hint as to your specific problem: backslashes, "\", are special characters in double quoted strings; Perl will allow you to use plain slashes, "/", in filenames that you pass to system calls to avoid just this kind of problem.)

The cake is a lie.
The cake is a lie.
The cake is a lie.

Replies are listed 'Best First'.
Re^3: problem opening file
by hipowls (Curate) on Jan 10, 2008 at 21:00 UTC

    And if you had warnings enabled you would have got warnings about unrecognized escapes. Putting them in I got these messages:

    Unrecognized escape \H passed through at Perl-1.pl line 22. Unrecognized escape \P passed through at Perl-1.pl line 22.
    It is considered good practice to start each script with
    use warnings; use strict;
    which will pick up a lot of these types of problems.

Re^3: problem opening file
by koleti (Novice) on Jan 10, 2008 at 19:10 UTC
    hello monks
    I tried using // because single / will be an escape character
    but it did not work even after doing that
    Unable to open file:No such file or directory at C:\Perl\hprd.pl line 14.
    is there any way to open files from a subdirectory

      No, a two slashes are . . . two slashes. Two backslashes make a single slash because the first escapes the later. It makes a difference which way they're pointing because they're different characters. Read the section on 'quotelike operators' in perlop.

      perl -le 'print "// \\"'

      The cake is a lie.
      The cake is a lie.
      The cake is a lie.