in reply to Re: Return array from sub or return empty array (updated)
in thread Return array from sub or return empty array
Thanks for all the great replies guys. What you have explained confirms what I thought was going on
Hauke, as you point out the issue is with undef. In some of the places in the API I'm working with an undef scalar can throw perl warnings in the log files. The simple solution is to just do:
@array2 = a_sub_that_returns_a_list || '';My main reason for asking the question was to understand what perl was doing with the || in the context I was using it and you guys have explained it well. Thanks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Return array from sub or return empty array (updated)
by haukex (Archbishop) on Jul 04, 2016 at 20:09 UTC |