http://qs321.pair.com?node_id=263566


in reply to passing subroutine args as a hash: why not?

I dont know if this is a good idea or not but I have taken to testing for a hash or hashref with something like the following:
#!/usr/bin/perl -w use strict; my %foo = ( a => 'b', b => 'c', ); print hash_or_hashref(%foo); print hash_or_hashref(\%foo); sub hash_or_hashref { die "missing options" unless $_[0]; # was it a hash or hashref passed. my $options; if (UNIVERSAL::isa($_[0], 'HASH')) { $options = shift; } else { $options = {@_}; } return $options->{a}; }