sub foo { my $arg = shift; if (exists $arg->{'fruit'} ) { .... } } foo( fruit => 'banana' );