my %args = (profile => 'foo'); my %ta = map {defined($args{$_} ? ($_ => $args{$_}) : ()} qw(profile user password); #### my @array = grep {COND} LIST; my @array = map {COND ? $_ : ()} LIST