Hi Group

I'm new to perl and haven't used it before. I'm still practising and trying
my best to know it. Anyway, I wanted to print the list of files in a
directory with their full pathnames. This script below worked fine but I
want to write it to a file. Can someone help me, please? I know it must be
very simple but as I said I very new to programming and perl is my new
programming language to learn.

------------------------------------------------
#!/bin/perl
 use File::Find <File::Find> ;
 my $ByteCount=0;
 
 open(OUTFILE > "c:\\perl\\output.txt") or die "Can't open output.txt: $!";
 
 find(\&pits, "W:\\Users\\PACLAWMAT\\PACIFIC TREATIES\\");
 print "Files are using $ByteCount bytes\n";
 # Subroutine that determines whether we matched the file extensions.
 sub pits {   
   if ((/\.doc$/)){      
      print OUTFILE "$File::Find::name\n";          
              
          #my ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size,
$therest) = stat($_) or die "Unable to stat $_\n";         
          $ByteCount += $size;
   }
   
  close(OUTFILE);

}


Thanks

John

Reply via email to