my %file; @routers{@ARRAY} = undef; @interfaces{@anotherarray} = undef if (exists $routers{$zero_arg} and not exists $interfaces{$sec_arg)) { #Do stuff }