in reply to Re: Re: Did I get what I expected (an array)?
in thread Did I get what I expected (an array)?
Furthermore, parenthesis do not create lists (except in some very specific syntax constructs). Parenthesis are used for grouping.
all mean the same. The do not differ just like there is no difference between:return $this; return ($this); return (($this)); return ((($this)));
As for3 + 4; (3 + 4); (3) + (4); ((3) + (4));
that will return the number of elements of @x in scalar context, and a list consisting of the elements of @x in list context. Perl will never return an array. You can check for yourself:return @x;
This gives a compile error:my @x = qw /foo bar baz/; sub my_func {return @x}; (my_func) [1] .= "hello";
Note that it says "list slice". A list, not an array.Can't modify list slice in concatenation (.) or string
Abigail
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Did I get what I expected (an array)?
by bronto (Priest) on Jul 17, 2002 at 08:21 UTC |