Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
P is for Practical
 
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 having an uproarious good time at the Monastery: (10)
As of 2014-04-21 08:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (492 votes), past polls