for (qw(a X b)) { my $id = $1 if /(a)/ or /(b)/; print qq{'$_' -> '$id'\n}; } #### C:/Perl_524/bin\perl.exe -w d:/exp/pm_or_regex.pl Use of uninitialized value $id in concatenation (.) or string at d:/exp/pm_or_regex.pl line 5. 'a' -> 'a' 'X' -> '' 'b' -> 'b'