[Edinburgh-pm] Perl: run-time error

Neill Russell neill.russell at gmail.com
Thu Apr 5 02:41:21 PDT 2007


On 5 Apr 2007, at 10:03, asmith9983 at gmail.com wrote:

> Hi folks
>
> I put together a small Perl script to check for missing sequence  
> numbers in file.  The program and the input test data are  
> attached.  I get a run-time error, but after many hours have failed  
> to track my error.  Any clues would be appreciated.
>
> -- 

it's to do with the way you're passing a reference of an array to  
your check_missing_ids routine.

you were assigning a scalar reference of the array reference to the  
array variable

   my @idlist=$$_[0];

you should deference the array reference if you're going to do this

   e.g.

   sub check_missing_ids
   {
   my @idlist=@{$_[0]};
   ...
   }
   ...
   &check_missing_ids(\@id_list);

OR

alternatively, just pass a plain old array in the first place

   sub check_missing_ids
   {
   my @idlist=@_;
   ...
   }
   ...
   &check_missing_ids(@id_list);

rgds,

neill




More information about the Edinburgh-pm mailing list