Haze Noc wrote:
> Hey guys, I have a method as such:
>
> def random(len)
>   if len !~ /\d+/
>     pub_send "Invalid number"

Are you aware that if len is a number this will always be true (and it would
be true no matter what regex you use).


>   elsif len > 30
>     pub_send "No more then 30 chars"

You will only get here when len is a string (containing one or more digits), 
so this will raise an error because you can't compare a string to a number.


> random($1) if $msg =~ /^rand (\d+)/
>
> the value of $1 will always be a number,

No. The value of $1 is *always* a string. "45" is not a number, it's a string
containing the character '4' and '5'. 45 is a number.
If you want a number call to_i on the string.


HTH
-- 
Jabber: sepp2k / jabber.org
ICQ: 205544826