Hi gurus,

I have a script that is causing me some trouble. I haven't pasted the whole script 
here 
as it is a bit long and I can't submit any test data. 

Basically the script copies and renames file. At the end I would like to print out a 
report of all the files it has renamed. These reports are used by another process 
later 
and the reports have to be unique to each user. 

At the start I glob a directory for tif files and these are added to the @tiffs array. 
Later 
a subroutine loops through the array and prints the file names into the user's log. 
However I only get the first file name from the file glob, all the others seem 
disappear. I have printed debug messages about the size of the array but it always 
has a length of 1 by the time it is in the sub routine.

Should I be using a array reference instead? It so can anyone explain how to use it?  
My initial attempts at using references has not been v. successful.

Thanx in advance.
Dp.

...snip
...snip
while (defined(my $i = <$inpath/*.tif>)) {
        chomp($i);
        my $n = lc($i);
        my $name = basename($n);
        print "added $name to array\n";
        push(@tiffs,$name);
        my $bar = @tiffs;
        ++$in;
        print "Array is now $bar big\n";
...
...
..
}
#  Create log
scanlog($log_path,@tiffs);

sub scanlog {

 my $log_path = shift;
 my (@tiffs) = shift;
 my $jpg;

 print "\n$log_path\n";

 my $user_file = new Logfile::Rotate(
        File => "$log_path",
        Count => 20,
        Gzip => "no",
        );

 $user_file->rotate();

print "opening $log_path\n";
open(SCAN,">$log_path") || die "Can't open $log_path: $!\n";

my $bar = @tiffs;
print "Starting loop with [EMAIL PROTECTED] = $tiffs[0] next is $tiffs[1]\n";
# $tiffs[1] prints undef

print "Array is $bar size\n";

foreach $jpg (@tiffs) {

# Put a carriage return in for MS WIN readers.
        my $grr = "$jpg"."\015";
        print "$jpg\n";
        print SCAN "$grr\n";
        }

close(SCAN);

}




~~
Dermot Paikkos * [EMAIL PROTECTED]
Network Administrator @ Science Photo Library
Phone: 0207 432 1100 * Fax: 0207 286 8668


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to