zhenyisong has asked for the wisdom of the Perl Monks concerning the following question:
I think the return value is the list contains 3 numbers, and when in the scalar context, the $value should be 3. However, the return value is the last element of the list. Even I used the conserved word 'scalar' before the function find_chores(), the returned value was still 310, not 3 as the expected. This is confusing me. Do I miss something here?use Modern::Perl; use autodie; sub find_chores { return (8,456,310); } my $value = find_chores(); say $value;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: why the output is not my expected?
by choroba (Cardinal) on Mar 31, 2017 at 07:13 UTC | |
by zhenyisong (Initiate) on Mar 31, 2017 at 07:34 UTC | |
|
Re: why the output is not my expected? (updated)
by haukex (Archbishop) on Mar 31, 2017 at 07:14 UTC |