On 8/29/06, Barron Snyder (CE CEN) <[EMAIL PROTECTED]> wrote:

For example, if I create a list like (123..456754), does it take up the
same amount of memory as if I actually entered all those in between
numbers?

Generally, yes.

I'm asking because I want to use ranges in a switch statement and they
are large ranges like the above. I don't think I can use >= in the case
section of the switch can I?

It depends. What programming language are you talking about? Perl
doesn't have case/switch statements, although there are some extension
modules that add that functionality. If you're using one of those
extension modules, you should check its documentation to see what it
allows.

            case [4096..8191]       { $block{"VoidItem"} = "Y";

Each of your cases seems to begin on a power-of-two. Would you be
really happy to discover the function int(log2($something))?

   sub log2 { log($_[0]) / log(2) }

The Perl FAQ has an extensive list of ways to write switch/case
statements in Perl. Perhaps one of those will be useful, with or
without log2.

Hope this helps!

--Tom Phoenix
Stonehenge Perl Training

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to