Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!convex!usenet From: tchrist@convex.COM (Tom Christiansen) Newsgroups: comp.lang.perl Subject: Re: Strange file-opening problem with perl 3.0@44 Message-ID: <1991Jan29.040547.10841@convex.com> Date: 29 Jan 91 04:05:47 GMT References: <142743@pyramid.pyramid.com> Sender: usenet@convex.com (news access account) Reply-To: tchrist@convex.COM (Tom Christiansen) Organization: CONVEX Software Development, Richardson, TX Lines: 45 Nntp-Posting-Host: pixel.convex.com From the keyboard of mfrost@sword.pyramid.com (Mark Frost): :The script seems to work fine now, except that at one particular point in the :file, it fails to open one particular file. The file-exists and is world :readable. If I put perl v41 back into place, the file works fine. I have :single-stepped through and found that it indeed misses the loop. Here's :the hunk o' code. : :# Figure out what host this script is being run on :$thishost = &gethostname; : :# Set host-specific configfile name :# Config file name is $thishost + ".config" :$hostconfigfile = "configs/". $thishost . ".config"; : : open(HOSTFILE, "$hostconfigfile" || die "Can't open $hostconfigfile\n"); : while () : { : : } # while : close(HOSTFILE); Try this instead: open(HOSTFILE, $hostconfigfile) || die "can't open $hostconfigfile: $!"; while () { # } close(HOSTFILE): The 2nd arg to open should be the name of the file. If you look carefully, you have: open(X,$x || die); instead of open(X,$x) || die; which changes things a great deal. --tom -- "Hey, did you hear Stallman has replaced /vmunix with /vmunix.el? Now he can finally have the whole O/S built-in to his editor like he always wanted!" --me (Tom Christiansen )