On Mon, Jul 6, 2009 at 08:00, Harry Putnam<rea...@newsguy.com> wrote:
snip
> Can anyone tell me how printing of $mode = 0755 turns into 493?
snip
>  my $mode = 0755;
snip
>             print "hpdb chmod $mode  $fname\n";
snip

0755 is 493.  More specifically they are two representations of the
same number: the first is in octal (base 8) and the second is in
decimal (base 10).  If you wish to print the number as octal you must
use [printf][1] or [sprintf][2]:

printf "hpdb chmod 0%o %s\n", $mode, $fname;

[1] : http://perldoc.perl.org/functions/printf.html
[2] : http://perldoc.perl.org/functions/sprintf.html

-- 
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to