Wow thanks for the reply okol (and for the benefit of the doubt!) I really learned a lot from all the replies, but yours is nice and simple and probably about as fast as possible.
I tried just a slight variation and I think it's going to work nicely.
use strict;
use warnings;
my %description = ( a => 'a vowel',
b => 'a consonant',
default => 'not in the alphabet' );
for my $char (qw/a b c/) {
my $d = $description{$char} || $description{default};
print("$char is $d\n");
}
I still can't quite get my head around the way that the logical or works. I would think that it would only return 1 or 0, but evidently here it's returning the whole string back again.
Anyway, thanks for all the help everybody. I did kinda post problem Y without getting into the specifics of problem X, but that was only because I thought X would bore everybody to tears!