Help for this page

Select Code to Download


  1. or download this
    if (defined($x) && eval { @$x || 1 }) {
        print "\$x can be used as an array ref (@$x)\n";
    } else {
        print "\$x cannot be used as an array ref\n";
    }
    
  2. or download this
    if ((reftype($x) || '') eq 'ARRAY') {
        print "\$x is an array ref (@$x)\n";
    } else {
        print "\$x is not an array ref\n";
    }