|
|
| Syntactic Confectionery Delight | |
| PerlMonks |
Re: Strange behavior of array in scalar contextby Anonymous Monk |
| on Jan 27, 2026 at 14:50 UTC ( [id://11167247]=note: print w/replies, xml ) | Need Help?? |
|
my @executions = $jobInfo->{'content'}{'executions'};
This puts whatever happens to be returned on the right-hand side into the first slot of the array @executions. It just happens that what you get is from the RHS not an empty array, but an empty arrayref. And this arrayref happens to occupy the first slot of the array @executions. Therefore, the array @executions has one element. See what print Dumper \@executions; returns instead. To turn an arrayref into an array (i.e. copy its contents to an array), you need to dereference it, or you can just keep using it as an arrayref. I usually do the latter.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||