The proper way to open()

Roger Burton West roger at firedrake.org
Mon Jan 30 16:46:00 GMT 2012


What's a good way of opening a file as read-only, and failing if it
doesn't exist? open() just returns a handle that's not obviously
invalid, which strikes me as odd behaviour. At the moment I'm doing
something like:

  open IN,"<$cfg";
  if (eof IN) {
    die "bad config file $cfg\n";
  }

R


More information about the london.pm mailing list