Just another Perl shrine | |
PerlMonks |
Re: why the output is not my expected?by choroba (Cardinal) |
on Mar 31, 2017 at 07:13 UTC ( [id://1186593]=note: print w/replies, xml ) | Need Help?? |
List is not array. Read about the Comma Operator in the documentation.
In scalar context it evaluates its left argument, throws that value away, then evaluates its right argument and returns that value. To get your expected output, you have to create an array:
or, if you don't want to name it:
Update: there are more than two ways how to create an array:
In Section
Seekers of Perl Wisdom
|
|