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 warnings; use strict;

use MD5;

use Digest::MD5;

require 'find.pl';

use File::Find;

$md5 = new MD5;

my $md5 = Digest::MD5->new;

@dirs = @ARGV;

foreach $dir ( @dirs ) { find($dir); }

my @files; find( \&wanted, @ARGV );

sub wanted { push @files, $name; }

You need to push the complete path into the array:

sub wanted { push @files, $File::Find::name }

foreach $name ( sort @files) {
   ($uid,$gid) = (stat $nane)[4,5];

my ( $uid, $gid ) = ( stat $name )[ 4, 5 ];

$stat = sprintf "%0o", (stat_)[2];
^^^^^
If you had strictures enabled (use strict) then perl would have informed you of this error and refused to compile your code.


     my $stat = sprintf '%o', (stat _)[2];

unless( -f $name ) {

unless( -f _ ) {

printf "$stat\t$uid $gid\t\t\t\t\t\t$name\n";

print "$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;

You should include the $! variable in the error message so you know *why* it failed.


   $md5->addfile(FILE);
   close FILE;
     $checksum - $md5->hexdigest();
   printf "$stat\t$uid $gid $checksum\t$name\n";

print "$stat\t$uid $gid $checksum\t$name\n";

}


John
--
use Perl;
program
fulfillment

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to