On Thu, Jun 07, 2001 at 12:39:33PM -0400, Andrew Nelson wrote:
> You can open a file via open() for reading or writing, but not both. Try
>
> open (FILE, $file);
> print FILE;
> close(FILE);
>
> And see if that doesnt help.
>
Not quite true. To read and write, try
open (FILE, "+<$file");
N
Adding $edgar/ seemed to fix it. If I seem pretty clueless, it's because
I've been programming for all of two days.
Thanks again,
Campbell
ll Meeks'; '[EMAIL PROTECTED]'
Sent: 6/7/2001 12:39 PM
Subject: RE: Problem with getting a file to open
You can open a file via open() for reading or writing, but not both. Try
open (FILE, $file);
print FILE;
close(FILE);
And see if that doesnt help.
-Original Message-
F
On Jun 7, Sara Campbell Meeks said:
>$edgar = "/home/Campbell/perl/edgar"
>
>opendir (EDGAR, $edgar) or die "Can't find $edgar!\n";
>
>while ($file = readdir EDGAR) {
> open (FILE, ">$file");
> print FILE;
>}
Problems of all sorts here. First, you're opening $file to bet WRITTEN
to
ECTED]'
Subject: Problem with getting a file to open
I have this bit of code:
#!/usr/bin/perl -w
$edgar = "/home/Campbell/perl/edgar"
opendir (EDGAR, $edgar) or die "Can't find $edgar!\n";
while ($file = readdir EDGAR) {
open (FILE, ">$file");
I have this bit of code:
#!/usr/bin/perl -w
$edgar = "/home/Campbell/perl/edgar"
opendir (EDGAR, $edgar) or die "Can't find $edgar!\n";
while ($file = readdir EDGAR) {
open (FILE, ">$file");
print FILE;
}
When I run the program I get this error message:
Use of uninitialized