[Chicago-talk] OK< *real* stupid Q time...

Walter Torres walter at torres.ws
Tue Sep 16 17:09:29 CDT 2003


OK, I have this piece that opens a file or dies trying with a little error
sent to STOUT.

   open( TEMP, ">>./$outFile ")
      or die "No Way! \n$!\n$outFile \n";

But, I have this in a loop of file names to parse.

So I need to have this try and open that file, and if it fails, send a call
to a function (that logs stuff) and tell the FOR loop to go on to the next
in the list.

I figure that there must be a way to test if a file can be opened before
actually opening it and then have conditionals around that....

   if (! open $outFile)
   {
      &to_log ("$outFile Error: $errCode");
      continue;
   }

I know I've done this before, but my brain dead head can't remember this,
nor have I been able to find any URL via GOGGLE that helps me.

Thanks for your patience through these basic questions.

That's what I get for not working in Perl for way too long!

Walter






More information about the Chicago-talk mailing list