From: "Dermot Paikkos" <[EMAIL PROTECTED]>
> 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.
> ...
> # Create log
> scanlog($log_path,@tiffs);
>
> sub scanlog {
>
> my $log_path = shift;
> my (@tiffs) = shift;
This should be
my @tiffs = @_;
The shift() only takes one scalar from @_, you want all of them.
Anyway it would be more efficient to pass just a reference to the
array:
scanlog( $log_math, [EMAIL PROTECTED]);
sub scanlog {
my ($log_path, $tiffs) = @_;
...
foreach $jpg (@$tiffs) {
...
HTH, Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]