Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • For strictness, there is sub HOME () {'home'} made behind scene. Commented Jan 26, 2009 at 13:21
  • When you have a subroutine which take in Phone::Type enum as argument, how do you perform dynamic checking on the subroutine argument is Phone::Type type enum, not string, not number... Commented Jun 25, 2009 at 10:13
  • Just for clarification sub HOME () {'home'} and use constant { HOME => 'Home', WORK => 'Work', MOBILE => 'Mobile', }; are the same? the later generates (Behind the scene) the code? Commented Jan 18, 2010 at 18:18
  • Your examples don't match up ;-), but yes, the current implementation does. See section TECHNICAL NOTES in perldoc constant. constant also does some name checking. For example, starting with double underscores is disallowed, and names like 'BEGIN' cause a warning (with 'use warnings') because they might be confusing. For details have a look at the implementation by calling 'perldoc -m constant'. Commented Jan 19, 2010 at 11:36
  • This is actually inaccurate as later version of Perl do. Look here stackoverflow.com/questions/473666/… Commented Jan 26, 2010 at 7:32