The script below is my first usage of perls `chmod', but it appears to be in keeping with the info at perldoc -f chmod.
But somehow in the print of $mode it turns into 493... even though it is set to 755. Its just the print though... the actual chmod appears to be working as expected. Can anyone tell me how printing of $mode = 0755 turns into 493? #!/usr/local/bin/perl use strict; use warnings; use File::Find; my $myscript; ($myscript = $0) =~ s/^.*\///; ## chmod mode my $mode = 0755; if(!...@argv || $ARGV[0] eq "help"){ print "Usage tripped at <" . __LINE__ . ">\n"; usage(); print "\`$myscript DIR' (needs 1 cmdline argument)\n"; exit; } my @dir = shift; if(@ARGV){ print "Usage tripped at <" . __LINE__ . ">\n"; usage(); print "Too many cmdline arguments\n"; exit; } find(\&wanted,@dir); sub wanted { if (-f $_){ print "hpdb Opening $_ \n"; open(FILE,"< $_") or die "Can't open $_ : $!"; my $fname = $_; while(<FILE>){ if ($. == 1 && /^\#\!/){ print "hpdb chmod $mode $fname\n"; chmod $mode, $fname or die "could not chmod '$mode $fname': $!"; last; } if ($. == 2){ last; } } close(FILE); } } sub usage { print " Purpose: bla Unfinished Usage: "; } A few lines of out put: [...] hpdb Opening form.cgi hpdb chmod 493 form.cgi hpdb Opening index.html hpdb Opening link.cgi hpdb chmod 493 link.cgi [...] -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/