in reply to What is the difference between a list and an array?

Basic difference is if I set
$scalar = @array;
I get the number of elemets in the array. However if I do
i $scalar = @list;
I get the first value of the list popped into this scalar value.

Replies are listed 'Best First'.
Re: Re: What is the difference between a list and an array?
by chromatic (Archbishop) on Dec 12, 2001 at 01:05 UTC
    Actually, those are both arrays. You might also amend the last sentence after running this code:
    my $scalar = (1, 2, 4, 8); print "Have: $scalar\n";
      List is something which is nothing but a group of scalar variables separated by comma(,). In order to use the list in PERL, we need to declare it in an array variable, prefixed by "@", or a hash variable prefixed by "%".