#!/usr/bin/perl $x='y'; # comment this line out to test undef case. %p = ( 'a' => 'B', 'z' => defined($x) ? $x : 'n', 'c' => 'D'); print $p{z}