Next Tricks of the Wizards 199

Another Tied Hash: %!

        unless (open FH, $filename) {
          if ($! == EACCES) {
            # Permission denied...
          } elsif ($! == ENOENT) {
            # No such file...
          } elsif ($! == ENOTDIR) {
            # Some part of the path is not a directory...
          } elsif ...
          }
        }
        unless (open FH, $filename) {
          if ($!{EACCES}) {
            # Permission denied...
          } elsif ($!{ENOENT}) {
            # No such file...
          } elsif ($!{ENOTDIR}) {
            # Some part of the path is not a directory...
          } elsif ...
          }
        }


Next Copyright © 2003 M. J. Dominus