in reply to The name of a constant

I'm not going to say that this is the best way to do it, just the first way that occurred to me. ;-)

#!/usr/bin/perl -w use strict; use Mail::CheckUser qw(:constants); my @constants = @{ $Mail::CheckUser::EXPORT_TAGS{constants} }; foreach my $constant (@constants) { print $constant, " = ", eval($constant), $/; }

Updated: Now prints the names of all the constants and their values.

Added: outputs:

CU_OK = 0 CU_BAD_SYNTAX = 1 CU_UNKNOWN_DOMAIN = 2 CU_DNS_TIMEOUT = 3 CU_UNKNOWN_USER = 4 CU_SMTP_TIMEOUT = 5 CU_SMTP_UNREACHABLE = 6