worley@compass.com (Dale Worley) (02/14/91)
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.