Alex B. <[EMAIL PROTECTED]> wrote:
...
>>> --- Allen Wang <[EMAIL PROTECTED]> wrote:
>>> > 
>>> > i want to generate an output file using perl
>>> > 
>>> > open (OFILE, " > /tmp/aa.lst") 
>>> >     or die "Can't write $p_OutputFile: $! ";
>>> > 
>>> > Everytime I ran it, I got the following error message.
>>> > 
>>> > Can't write /tmp/aa.lst: No such file or directory  at compare.pl
>>> > line 71.
...
> 
> try using:
> open (OFILE, " +> /tmp/aa.lst") or die "Can't write $p_OutputFile: $! ";
                ^

You're allowed to put whitespace in between the mode 
and filename, but you can't put any before the mode.

These snippets are equivalent to

  open OFILE, '<', ' +> /tmp/aa.lst'
                    ^^^^^^^^^^^^^^^ filename
               ^ mode

So just remove the leading space, or use the 3 argument form.

  open OFILE, '> /tmp/aa.lst'
  open OFILE, '>', '/tmp/aa.lst' 

-- 
Steve

perldoc -qa.j | perl -lpe '($_)=m("(.*)")'

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to