Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!bcm!convex!tchrist From: tchrist@convex.COM (Tom Christiansen) Newsgroups: comp.lang.perl Subject: Re: chmod() with a $variable mode Keywords: chmod Message-ID: <1991Feb26.190757.4430@convex.com> Date: 26 Feb 91 19:07:57 GMT References: <393@camdev.comm.mot.com?> Sender: tchrist@convex.com (Tom Christiansen) Reply-To: tchrist@convex.COM (Tom Christiansen) Organization: CONVEX Software Development, Richardson, TX Lines: 31 From the keyboard of mmuegel@mot.com (Michael S. Muegel): :I have been trying to get chmod working with a non-numeric mode argument :(e.g. a scalar variable). I seems that the following: : : chmod ($Mode, $File); : :does not work as expected. I think it is using the ASCII numerical values :or the like. When I do a ls -l I get bits I did not even know existed! If what's really happening is what I think is happening, consider this: print "mode? "; chop($Mode = ); printf "mode is %04o\n", $Mode; chmod $Mode, $File; This may clear some things up. If your mode is not a literal, like this: $Mode = 0644; then you'll have to octify it: $Mode = oct($Mode); --tom -- "UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things." -- Doug Gwyn Tom Christiansen tchrist@convex.com convex!tchrist