Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: How do I restrict a variable to a range of values?

by bofh_of_oz (Hermit)
on Jul 27, 2005 at 15:17 UTC ( #478636=note: print w/replies, xml ) Need Help??


in reply to How do I restrict a variable to a range of values?

In two words: you don't.

In many more words: You can't restrict a variable from having any value it gets assigned. You can, however, write a validation block to check for valid values and complain|die|ignore the rest. I believe that's how it's being done in most cases...

--------------------------------
An idea is not responsible for the people who believe in it...

  • Comment on Re: How do I restrict a variable to a range of values?

Replies are listed 'Best First'.
Re^2: How do I restrict a variable to a range of values?
by salva (Abbot) on Jul 27, 2005 at 15:37 UTC
    You can't restrict a variable from having any value it gets assigned.

    yes you can, using tie or at a lower level XS magic.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://478636]
help
Chatterbox?
[choroba]: Good morning from home!
[choroba]: (took a sickday to stay with my son)

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2017-04-27 07:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (501 votes). Check out past polls.