in reply to Enum
you can just go $my type_of_fruit = 'orange';. This kind of logic is the most common use of enums I've seen in C.my $type_of_fruit = enum->{'ORANGE'};
Of course, numerical comparisons will be faster than string comparisons, so if you are examining many such values (e.g. in an extended chain of elsif's) then a C-like enum might be useful. What were you planning to do with your enum? That's probably the right question to ask.
Just my $.02. Perl is different from C. It may not make sense to use the same idioms you learned in C.
|
|---|