<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:10pt"><div><span>if (-f '/blah/blah') {open F, "</blah/blab"} else { </span><span>open F, "</blab"}. <br></span></div><div><br><span></span></div><div><span>maybe ?: will work too.<br></span></div><div><br></div><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt;"><div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"><font face="Arial" size="2"><hr size="1"><b><span style="font-weight:bold;">From:</span></b> Richard Reina <richard@rushlogistics.com><br><b><span style="font-weight: bold;">To:</span></b> chicago-talk@pm.org<br><b><span style="font-weight: bold;">Sent:</span></b> Thursday, June 30, 2011 1:46 PM<br><b><span style="font-weight: bold;">Subject:</span></b> [Chicago-talk] OPEN() conditional<br></font><br>
I am writing a script that among other things edits a file.  The file can be in one of two places (directories) so if the first open does not work I want it to try the open of the file in the alternative directory.  I know how to do open(F, "</blah/blah") || die or open(F, "</lbal") || warn; but I don't want the program to die but to try another directory.  Is there a way to do open() conditionals or do I need to use readdir first to see if the file exists?<br><br>Thanks,<br><br>Richard<br>-- <br>Richard Reina<br>Rush Logistics, Inc.<br>Watch our 3 minute movie: <br>http://www.rushlogistics.com/movie<br><br>_______________________________________________<br>Chicago-talk mailing list<br><a ymailto="mailto:Chicago-talk@pm.org" href="mailto:Chicago-talk@pm.org">Chicago-talk@pm.org</a><br>http://mail.pm.org/mailman/listinfo/chicago-talk<br><br><br></div></div></div></body></html>