in reply to why the output is not my expected?

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:

sub find_chores { return my @arr = (8, 456, 310); }

or, if you don't want to name it:

sub find_chores { return @{ [ 8, 456, 310 ] } }

Update: there are more than two ways how to create an array:

sub find_chores { return map $_, 8, 456, 310; }

($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

Replies are listed 'Best First'.
Re^2: why the output is not my expected?
by zhenyisong (Initiate) on Mar 31, 2017 at 07:34 UTC
    Thanks,@choroba. I did not notice the difference between array and list.