sub func { my %args = ( # default options option1 => "Foo", option2 => "Bar", @_, # passed options ); if ($args{option1}) { ... } if ($args{option2}) { ... } } func(option1 => "Foozball", option2 => "Barracuda");