[Chicago-talk] OPEN() conditional
Richard Reina
richard at rushlogistics.com
Fri Jul 1 06:22:04 PDT 2011
Thank you Shawn and Tiger for sharing your wisdom.
> These are both practical and elegant solutions.
>
> Have a great holiday.
>
> Richard
>
> Chicago.pm chatter <chicago-talk at pm.org> wrote: > > if (-f '/blah/blah') {open F, "</blah/blab"} else
> { open F, "</blab"}.
>
> maybe ?: will work too.
>
> > From: Richard Reina <richard at rushlogistics.com>
> To: chicago-talk at pm.org
> Sent: Thursday, June 30, 2011 1:46 PM
> Subject: [Chicago-talk] OPEN() conditional
>
> 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?
>
> Thanks,
>
> Richard
> --
> Richard Reina
> Rush Logistics, Inc.
> Watch our 3 minute movie:
> http://www.rushlogistics.com/movie
>
> _______________________________________________
> Chicago-talk mailing list
> Chicago-talk at pm.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/chicago-talk/attachments/20110701/531eefa1/attachment-0001.html>
More information about the Chicago-talk
mailing list