in reply to Can't use an undefined value as an ARRAY reference at ./test.pl line 14.

davido has explained WHAT the problem it.

To answer your question on how to initialize lib :

my $lib =[]; # A reference to an empty array
Will resolve the issue.

Another alternative is to check for $lib to be defined before checking scalar @$lib.

        ...it is unhealthy to remain near things that are in the process of blowing up.     man page for WARP, by Larry Wall

  • Comment on Re: Can't use an undefined value as an ARRAY reference at ./test.pl line 14.
  • Download Code