Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Re: chmod and oct

by mce (Curate)
on Dec 06, 2002 at 08:48 UTC ( [id://218010]=note: print w/replies, xml ) Need Help??


in reply to Re: chmod and oct
in thread chmod and oct

Thanks,

Than my first code was wrong, as it should be:

chmod 0755, $file; # and not chmod '0755', $file;
It is because my variable $chmod is regarded as a string and not a number, that is fails.

Why doesn't a trick like this work then?

$chmod='0644'; chmod $chmod+0, $file;
Please note that it is friday today, and this might explain my stuped questions :-)


---------------------------
Dr. Mark Ceulemans
Senior Consultant
IT Masters, Belgium

Replies are listed 'Best First'.
Re: Re: Re: chmod and oct
by dws (Chancellor) on Dec 06, 2002 at 08:55 UTC
    Why doesn't a trick like this work then?
    $chmod='0644'; chmod $chmod+0, $file;
    It doesn't work because "leading zero means octal" applies only to numbers, not strings of numeric digits.

    Try this:   print 0644, " != ", '0644' + 0, "\n"; This is all described in the on-line doc, in perldata.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://218010]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2024-04-25 07:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found