Is that no coercion?
my @array = $scalar;
Definitely not. List assignment takes a list of scalars, and that's exactly what you provided. It's no more a scalar being coerced into an array than my @array = foo(); is a function call being coerced into an array.
my $scalar = @array;
Type coercion is the changing an entity from one type to another, but that's not what that statement does. The array isn't assigned to $scalar as a different type. It's count is assigned, and that's a completely different entity.
Furthermore, no array is ever present to be coerced. @array acts like a function. It takes an arg and returns a value based on the input and context. Note that there does not exist a function anywhere in Perl's code to coerce an array into a scalar.
In reply to Re^4: compiling perl scripts aka why is perl not as fast as C
by ikegami
in thread compiling perl scripts aka why is perl not as fast as C
by punkish
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |