deny wrote:
That isn't only perl code, it's incomplete, and it
doesn't use 'printf'. Show us more code and explain
your problem fully.
thanks for your help
here is the complete code
#!/usr/bin/perl
use MD5;
require 'find.pl';
$md5 = new MD5;
@dirs = @ARGV;
foreach $dir ( @dirs ) { find($dir); }
sub wanted { push @files, $name; }
foreach $name ( sort @files) {
($uid,$gid) = (stat $nane)[4,5];
$stat = sprintf "%0o", (stat_)[2];
unless( -f $name ) {
printf "$stat\t$uid $gid\t\t\t\t\t\t$name\n";
next;
}
$md5->reset();
open FILE, $name or print(STDERR "can't open file $name\n"), next;
$md5->addfile(FILE);
close FILE;
$checksum - $md5->hexdigest();
printf "$stat\t$uid $gid $checksum\t$name\n";
}
it aim to calcute sum permission on the dir in @ARGV;
and with diff ,you can see if files was modified
but the result isnt fine as you can see below
[EMAIL PROTECTED] cgi-bin]$ ./checksum.pl /bin
0 /bin
0 /bin/arch
0 /bin/awk
0 /bin/basename
0 /bin/bash
0 /bin/bash2
0 /bin/cat
0 /bin/chgrp
0 /bin/chmod
thanks
Try to add this lines somewhere the top of the file:
use strict;
use warnings;
and report the errors, if any.
--
Flemming Greve Skovengaard Just a few small tears between
a.k.a Greven, TuxPower Someone happy and one sad
<[EMAIL PROTECTED]> Just a thin line drawn between
4112.38 BogoMIPS Being a genius or insane
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>