Our enum type ServerState has an underlying int type.
To run the Perl script, save it to a file, for example, enums.pl, and execute it using the Perl interpreter.
In this example, we defined the enum-like structure using constants and leveraged a hash to map state values to their respective names in a human-readable format. We also implemented a transition subroutine to handle state transitions for a server, showcasing how you can work with enums in Perl. The main function demonstrates the state transitions by printing out the states using the state_to_string subroutine.