[16940] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 4352 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Sep 17 21:10:36 2000

Date: Sun, 17 Sep 2000 18:10:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <969239409-v9-i4352@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sun, 17 Sep 2000     Volume: 9 Number: 4352

Today's topics:
        Using range operator <randy_734@my-deja.com>
    Re: Using range operator <aqumsieh@hyperchip.com>
    Re: Using range operator <godzilla@stomp.stomp.tokyo>
    Re: Using range operator <uri@sysarch.com>
    Re: Using range operator <godzilla@stomp.stomp.tokyo>
    Re: Using range operator <wyzelli@yahoo.com>
    Re: Using range operator <uri@sysarch.com>
    Re: Using range operator (Randal L. Schwartz)
    Re: Using range operator <godzilla@stomp.stomp.tokyo>
    Re: Using range operator <godzilla@stomp.stomp.tokyo>
    Re: which the best scripting language? <nospam@david-steuber.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Sun, 17 Sep 2000 22:54:33 GMT
From: Randy <randy_734@my-deja.com>
Subject: Using range operator
Message-Id: <39c54b34.25459234@207.126.101.100>

Is there a simple way to use the range operator to check if a value
falls within?

Something like:

$num=5;
print "In range\n" if ($num == (1..20));

TIA


------------------------------

Date: Sun, 17 Sep 2000 23:35:44 GMT
From: Ala Qumsieh <aqumsieh@hyperchip.com>
Subject: Re: Using range operator
Message-Id: <7absxma8x9.fsf@merlin.hyperchip.com>


Randy <randy_734@my-deja.com> writes:

> Is there a simple way to use the range operator to check if a value
> falls within?
> 
> Something like:
> 
> $num=5;
> print "In range\n" if ($num == (1..20));

Why do you want to use the range operator? Why not simply:

	print "In range" if $num >= 1 && $num <= 20;

??

--Ala


------------------------------

Date: Sun, 17 Sep 2000 16:53:30 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Using range operator
Message-Id: <39C5597A.5AD3FA84@stomp.stomp.tokyo>

Randy wrote:
 
> Is there a simple way to use the range operator to 
> check if a value falls within?
 
> Something like:
 
> $num=5;
> print "In range\n" if ($num == (1..20));
 

This is a simple numerical range check with
three input arguments represented by $number,
which represents a number to compare to a range
and, $begin_range and $end_range, which sets
an inclusive numerical range. Caution should
be used regarding how large of a range is set.
Memory can be eaten up for a very large range,
if a range much like they have in Texas.

#!/usr/local/bin/perl

print "Content-type: text/plain\n\n";

$number = 5;
$begin_range = 0;
$end_range = 10;

for ($iterate = $begin_range; $iterate <= $end_range; $iterate++)
 {
  if ($iterate == $number)
   { print "$number is within a range of $begin_range to $end_range,
inclusive."; last; }
  elsif ($iterate == $end_range)
   { print "$number is not within a range of $begin_range to $end_range,
inclusive."; }
 }

exit;


Godzilla!
-- 
Dr. Kiralynne Schilitubi ¦ Cooling Fan Specialist
UofD: University of Duh! ¦ ENIAC Hard Wiring Pro
BumScrew, South of Egypt ¦ HTML Programming Class


------------------------------

Date: Mon, 18 Sep 2000 00:09:11 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Using range operator
Message-Id: <x7d7i2ftnb.fsf@home.sysarch.com>

>>>>> "G" == Godzilla!  <godzilla@stomp.stomp.tokyo> writes:

  G> This is a simple numerical range check with
  G> three input arguments represented by $number,
  G> which represents a number to compare to a range
  G> and, $begin_range and $end_range, which sets
  G> an inclusive numerical range. Caution should
  G> be used regarding how large of a range is set.
  G> Memory can be eaten up for a very large range,
  G> if a range much like they have in Texas.


ROTFLMAO!!

what texas horseshit that is!! you write a basic for loop and claim it
will use memory if it has a large number? typical moronzilla who doesn't
understand fundamental programming issues.

  G> #!/usr/local/bin/perl

  G> print "Content-type: text/plain\n\n";

  G> $number = 5;
  G> $begin_range = 0;
  G> $end_range = 10;

  G> for ($iterate = $begin_range; $iterate <= $end_range; $iterate++)
  G>  {
  G>   if ($iterate == $number)
  G>    { print "$number is within a range of $begin_range to $end_range,
  G> inclusive."; last; }
  G>   elsif ($iterate == $end_range)
  G>    { print "$number is not within a range of $begin_range to $end_range,
  G> inclusive."; }
  G>  }

and why do a loop when a pair of comparisons (posted by ala) will do
fine. and your code is SLOW and will get slower as the range gets
wider. 

typical crapola.

now, go away already. do your harm elsewhere.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


------------------------------

Date: Sun, 17 Sep 2000 17:15:41 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Using range operator
Message-Id: <39C55EAD.C7BE364A@stomp.stomp.tokyo>

Uri Guttman wrote:
 
> >>>>> "G" == Godzilla!  <godzilla@stomp.stomp.tokyo> writes:
 
>   G> This is a simple numerical range check with
>   G> three input arguments represented by $number,
>   G> which represents a number to compare to a range
>   G> and, $begin_range and $end_range, which sets
>   G> an inclusive numerical range. Caution should
>   G> be used regarding how large of a range is set.
>   G> Memory can be eaten up for a very large range,
>   G> if a range much like they have in Texas.
 
> ROTFLMAO!!
 
> what texas horseshit that is!! you write a basic for loop
> and claim it will use memory if it has a large number? 
> typical moronzilla who doesn't understand fundamental
> programming issues.



"...for a very large range...."


Your reading comprehension skills are very typical
of a high school drop out. Your behavior is quite
stereotypical of an eight year old boy. It is
equally clear you know very little about
Perl programming.

Your illiteracy and lack of skills in Perl programming
reduces any potential dialog with you to, pointless.


Godzilla!
-- 
Dr. Kiralynne Schilitubi ¦ Cooling Fan Specialist
UofD: University of Duh! ¦ ENIAC Hard Wiring Pro
BumScrew, South of Egypt ¦ HTML Programming Class


------------------------------

Date: Mon, 18 Sep 2000 09:47:17 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Using range operator
Message-Id: <n9dx5.5$d02.1570@vic.nntp.telstra.net>


"Godzilla!" <godzilla@stomp.stomp.tokyo> wrote in message
news:39C5597A.5AD3FA84@stomp.stomp.tokyo...

> Caution should
> be used regarding how large of a range is set.
> Memory can be eaten up for a very large range,
> if a range much like they have in Texas.

Time will be used rather than memory in a loop like you coded. Typical
Texas ego!  There is a single cattle station (you would call it a ranch)
here that all of Texas would fit into five times over!

Wyzelli




------------------------------

Date: Mon, 18 Sep 2000 00:24:36 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Using range operator
Message-Id: <x7aed6fsxq.fsf@home.sysarch.com>

>>>>> "G" == Godzilla!  <godzilla@stomp.stomp.tokyo> writes:

  G> "...for a very large range...."

  G> Your illiteracy and lack of skills in Perl programming
  G> reduces any potential dialog with you to, pointless.

heh heh heh!

a simple for loop is not affected by the RANGE of its values in any way
shape of form. it is a simple increment and that does not affect
memory. the .. range operator can be a memory hog if used with a large
range, but you talked about your code here:

  G> This is a simple numerical range check with three input arguments
  G> represented by $number, which represents a number to compare to a
  G> range and, $begin_range and $end_range, which sets an inclusive
  G> numerical range. Caution should be used regarding how large of a
  G> range is set.  Memory can be eaten up for a very large range, if a
  G> range much like they have in Texas.

is that not talking about your for loop code? can you answer with a
simple yes or no?

tell me which uses more memory:

	for( $i = 0 ; $i < 100 ; $i++ ) {

or 

	for( $i = 0 ; $i < 1_000_000_000 ; $i++ ) {

answer that as well. just pick the one which uses more memory

<waiting and laughing. i needed some real stupidity to laugh at today>

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


------------------------------

Date: 17 Sep 2000 17:26:09 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Using range operator
Message-Id: <m1snqy35r2.fsf@halfdome.holdit.com>

>>>>> "Godzilla" == Godzilla!  <godzilla@stomp.stomp.tokyo> writes:

G> This is a simple numerical range check with
G> three input arguments represented by $number,
G> which represents a number to compare to a range
G> and, $begin_range and $end_range, which sets
G> an inclusive numerical range. Caution should
G> be used regarding how large of a range is set.
G> Memory can be eaten up for a very large range,
G> if a range much like they have in Texas.
 
>> ROTFLMAO!!
 
>> what texas horseshit that is!! you write a basic for loop
>> and claim it will use memory if it has a large number? 
>> typical moronzilla who doesn't understand fundamental
>> programming issues.



Godzilla> "...for a very large range...."


Godzilla> Your reading comprehension skills are very typical
Godzilla> of a high school drop out. Your behavior is quite
Godzilla> stereotypical of an eight year old boy. It is
Godzilla> equally clear you know very little about
Godzilla> Perl programming.

No, Kira, I'm afraid he's right.  These two loops consume the
same amount of memory:

        for ($i = 1; $i <= 100; $i++) {
          $sum = $sum + $i;
        }

and

        for ($i = 1; $i <= 10000000; $i++) {
          $sum = $sum + $i;
        }

The size of the range isn't what matters.  It's what you do with it.
Sure, if you built an array with a huge range, the array would get
proportionately bigger, but your "testing" code merely gets slower as
the range gets bigger.

And the simple comparison posed by others beats your "for" loop by
far, except for the extreme case of the range being only one or two
elements long. {grin}

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


------------------------------

Date: Sun, 17 Sep 2000 17:29:28 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Using range operator
Message-Id: <39C561E8.BC2E7F06@stomp.stomp.tokyo>

Wyzelli wrote:
 
> "Godzilla!" <godzilla@stomp.stomp.tokyo> wrote in message
> news:39C5597A.5AD3FA84@stomp.stomp.tokyo...
 
> > Caution should
> > be used regarding how large of a range is set.
> > Memory can be eaten up for a very large range,
> > if a range much like they have in Texas.
 
> Time will be used rather than memory in a loop like you coded. Typical
> Texas ego!  There is a single cattle station (you would call it a ranch)
> here that all of Texas would fit into five times over!



Time ~ Memory, perhaps splitting hairs. Time would be
a closer technological term, however memory is used
for a long time, much like your being nowhere for
a long time. I will concede, if you choose to speak
Techno-Geekster Gibberish, which I do not, a lot
of processing time will be consumed for a large range
and, a block of memory will be unavailable, for an
equally long time. Memory is gobbled up. Slippery
Semantics for an English teacher; reading comprehension
challenges for a Techno-Geekster. 

Fine hairs, I have, as any of my telescope neighbors 
will comment, least during cool Fall, Winter and Spring.

In Oklahoma, our mosquitoes are so large, we use their
wings to roof our farm houses, barns and chicken coops,
one wing being enough to do a large farmstead.


Godzilla!
-- 
Dr. Kiralynne Schilitubi ¦ Cooling Fan Specialist
UofD: University of Duh! ¦ ENIAC Hard Wiring Pro
BumScrew, South of Egypt ¦ HTML Programming Class


------------------------------

Date: Sun, 17 Sep 2000 17:44:45 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Using range operator
Message-Id: <39C5657D.707339AF@stomp.stomp.tokyo>

"Randal L. Schwartz" wrote:
 
> Godzilla! writes:
 
(snipped)

> No, Kira, I'm afraid he's right.  These two loops consume the
> same amount of memory:

No, Randal, Mr. Buttman is dead wrong as usual due to
his exceptionally high rate of illiteracy. Read his
comments again, for comprehension. As usual, he shot
his mouth off before loading his brain.

 
> The size of the range isn't what matters.  It's what you do with it.
> Sure, if you built an array with a huge range, the array would get
> proportionately bigger, but your "testing" code merely gets slower as
> the range gets bigger.

Yes. See my other article for comments on Techno-Geekster
comprehension and plain English comprehension. Should a
range be built with an array, of course, you are right,
memory would be eaten up like crazy by a large range array.

 
> And the simple comparison posed by others beats your "for" loop by
> far, except for the extreme case of the range being only one or two
> elements long. {grin}

Nope. Other codes pale compared to what my code does and has
potential to do. Consider an associative array of data, for
example, lab results containing a test number, control quality,
test results and other data such as comments. Easy enough to
enclose my code within a foreach array construct to look for
certain criteria, numerically. If 'control quality' is rated
0 to 10, 0 being no controls, 5 being average, 10 being excellent..
very easy to use this construct to parse out control quality
by a numerical rating from an associative array of data.

Other codes posted, yes, they work but don't do anything
close to what my code does, nor do they have the potential my
code has. This is clear as other codes do not allow for input
arguments nor print a user readable statement as to results.

My long experience as a woman has taught me shorter is often not better.

*smiles*


Godzilla!
-- 
Dr. Kiralynne Schilitubi ¦ Cooling Fan Specialist
UofD: University of Duh! ¦ ENIAC Hard Wiring Pro
BumScrew, South of Egypt ¦ HTML Programming Class


------------------------------

Date: Sun, 17 Sep 2000 22:22:54 GMT
From: David Steuber <nospam@david-steuber.com>
Subject: Re: which the best scripting language?
Message-Id: <m3n1h63bgj.fsf@solo.david-steuber.com>

brian@smithrenaud.com (brian d foy) writes:

' well, it depends on the task.  i try not to decide the best way to
' solve a problem before i know what it is ;)

You mean should you use a ball-peen hammer or a sledge? ;-)

-- 
David Steuber | Perl apprentice, Apache/mod_perl user, and
NRA Member    | general Internet web wannabe.
ICQ# 91465842  (Using Micq 0.4.6 under Linux)

It's time to be free: http://www.harrybrowne2000.org


------------------------------

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V9 Issue 4352
**************************************


home help back first fref pref prev next nref lref last post