Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Restricting a scalar to certain values

by tobyink (Abbot)
on Jun 20, 2013 at 08:56 UTC ( #1039921=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/env perl
    
    ...
    $scalar = "foo";  # ok
    $scalar = "bar";  # ok
    $scalar = "baz";  # dies
    
  2. or download this
    use constant DEBUG => !!$ENV{DEVELOPMENT_SERVER};
    
    my $scalar;
    ttie $scalar, enum ["foo", "bar"] if DEBUG;
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1039921]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (8)
As of 2015-06-03 16:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What kind of chocolate gives you the most pleasure?















    Results (137 votes), past polls