my $error_id = "invalid_email"; my $error_message = { invalid_email => "Email address invalid", missing_foo => "Foo is missing", ... }->{$error_id};