Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
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 wandering the Monastery: (6)
As of 2014-11-26 00:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (160 votes), past polls