I know I could use the filehandle but I am trying to understand why I cannot
use the array and print each element at the time.
#!/usr/bin/perl
use strict;
use Fcntl;
$/ = "\n\n";
sysopen(readFile, "cnnArticle.txt", O_RDONLY) || die $!;
sysopen(writeFile, "fortuneCookie.txt", O_WRONLY|O_CREAT) ||
#!/user/bin/perl
use strict;
use fcntl;
my $path1 = "export.txt";
my $path2 = "export3.txt";
sysopen(openFile, $path1, O_RDONLY) || die $!;
sysopen(writeFile, $path2, O_WRONLY|O_CREAT ) || die $!;
while()
{
print writeFile $1, $2 ,"n\n" if m/(\w+\s)(\w+\s)/;
}
_
It is failing at line 5
#!/user/bin/perl
$path1 = "export.txt";
$path2 = "export3.txt";
sysopen(openFile, $path1, O_RDONLY) || die $!;
sysopen(writeFile, $path2, O_WRONLY | O_CREAT ) || die $!;
while()
{
print writeFile $1, $2 ,"n\n" if m/(\w+\s)(\w+\s)/;
}
__
My export.txt file has data in the format
Joe Doe mail: [EMAIL PROTECTED]
I want my script to replace mail for email. At the end of the script I get
an empty file? Why what am i doing wrong
#!/user/bin/perl
open(openFile, "export.txt");
while()
{
print writeFile if s/mail/email/ ;
}
___