PilotinControl has asked for the wisdom of the Perl Monks concerning the following question:
Good Evening Monks!
I have a light sensor and I need to capture a numeric range from the serial monitor to which I've already done commands using simple letter matches. Number matches I am completely lost with outside of the normal $data == 5 (do something) and so on. I need to capture a range of 200-300 and 400-500 so I can issue a command based on any number within that range. For example:
if ($range ==/300-400/) { exit; } if ($range == /425-500/) { print STDOUT "LIGHTS ON"\n; }
and so on. Of course I know that it is not that simple. I do believe it has to do with regexp and numerical expressions? Thanks in advanced!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Match Numeric Range
by Athanasius (Archbishop) on Aug 18, 2015 at 04:06 UTC | |
by Monk::Thomas (Friar) on Aug 18, 2015 at 21:35 UTC | |
by PilotinControl (Pilgrim) on Aug 18, 2015 at 11:56 UTC | |
Re: Match Numeric Range
by dbuckhal (Chaplain) on Aug 18, 2015 at 05:31 UTC | |
by PilotinControl (Pilgrim) on Aug 18, 2015 at 13:56 UTC | |
Re: Match Numeric Range
by roboticus (Chancellor) on Aug 18, 2015 at 12:43 UTC | |
by PilotinControl (Pilgrim) on Aug 18, 2015 at 13:53 UTC | |
by Your Mother (Archbishop) on Aug 18, 2015 at 14:14 UTC | |
by PilotinControl (Pilgrim) on Aug 18, 2015 at 14:39 UTC | |
Re: Match Numeric Range
by pme (Monsignor) on Aug 18, 2015 at 15:51 UTC | |
by PilotinControl (Pilgrim) on Aug 19, 2015 at 14:11 UTC |
Back to
Seekers of Perl Wisdom