Erwin Zavala wrote:
> It is failing at line 5
>
> #!/user/bin/perl

use strict;        # always!

use Fcntl;

> $path1 = "export.txt";
> $path2 = "export3.txt";
> sysopen(openFile, $path1, O_RDONLY) || die $!;
> sysopen(writeFile, $path2, O_WRONLY | O_CREAT ) || die $!;
> while(<openFile>)
> {
> print writeFile $1, $2 ,"n\n" if m/(\w+\s)(\w+\s)/;
> }


Hi Erwin.

Each day, before I start my work, I recite the mantra
'use strict' 473 times. It has changed my life - other
programmers no longer laugh at my bugs and I am
much more confident at parties. I recommend it ;-D

You need to 'use Fcntl'. Without this, the values O_RDONLY,
O_WRONLY and O_CREAT are 'barewords' to Perl, and will
the expression O_WRONLY | O_CREAT will do a bitwise 'or'
on the two strings. The result is equal to 'O_WROO\Y', which
is not really what you want! The Fcntl module will define
these constants to their correct numeric values.

Had you used the 'strict' pragma Perl would have pointed
out your errors immediately as it disallows barewords
except in very tightly restricted circumstances - usually
as hash keys.

I hope this helps.

Rob






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

Reply via email to