in reply to if (ref $value eq "ARRAY") {

I think this code will hear most quacks.

use strict; sub store_value { my @range; push @range, (ref $_[0] eq "ARRAY") ? @{$_[0]} : @_; print "range is ",join(",",@range),"\n"; } store_value(1); store_value(1..3); store_value([1..3]);

If you add  while (shift) { ... } it will work even with (1, 2, [3, 4], 5)