Problems with while loop and array

2003-03-16 Thread Erwin Zavala
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) ||

I thought fcntl would take care if barewords

2003-03-15 Thread Erwin Zavala
#!/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)/; } _

why does sysopen fails to create a file?

2003-03-14 Thread Erwin Zavala
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)/; } __

s// is deletng my entries

2003-03-13 Thread Erwin Zavala
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/ ; } ___