Scalar::Util's reftype function consistantly returns the type and might be a better choice here:
use Scalar::Util qw/reftype/; my @arr = reftype( $x ) eq 'ARRAY' ? @$x : ( $x );
In reply to Re: elegant array assignment
by snoopy
in thread elegant array assignment
by lackita
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |