Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!decwrl!mcnc!uvaarpa!mmdf From: worley@compass.com (Dale Worley) Newsgroups: comp.lang.perl Subject: perl chmod problem Message-ID: <1991Feb13.220435.24393@uvaarpa.Virginia.EDU> Date: 13 Feb 91 22:04:35 GMT Sender: mmdf@uvaarpa.Virginia.EDU (Uvaarpa Mail System) Reply-To: worley@compass.com Organization: The Internet Lines: 31 X-Name: Steven S. Dick The program looks something like this: print "chmod $perms, @filelist\n"; chmod $perms, @filelist; It prints the correct thing, but doesn't give the file the right permissions. If I hard code the permissions, it works: chmod 0600, @filelist; The print above DOES print 0600. The problem is that $perms has the string value "0600", but chmod demands a number for its first argument. Although 0600 when coded in a program is interpreted as an octal number, when the string 0600 is coerced at runtime from string to number, it is interpreted in decimal. (Inconsistency?) Consider the program: print "0600"+0, "\n"; print 0600+0, "\n"; which prints: 600 384 You need to find some way to convert an octal string to its numeric value. Dale Worley Compass, Inc. worley@compass.com -- True, money _can't_ buy happiness, but it isn't happiness I want. It's money.