[16390] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3802 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jul 25 18:15:37 2000

Date: Tue, 25 Jul 2000 15:15:25 -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: <964563325-v9-i3802@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 25 Jul 2000     Volume: 9 Number: 3802

Today's topics:
        Reserved word <chuckwNOchSPAM@silverlink.net.invalid>
    Re: Reserved word (Abigail)
    Re: Reserved word (Abigail)
    Re: Reserved word (NP)
    Re: Reserved word <tony_curtis32@yahoo.com>
    Re: Search and delete <lr@hpl.hp.com>
    Re: Sending email with attachment <peter.sundstrom@eds.com>
    Re: Simple Question? <lr@hpl.hp.com>
    Re: Suggestion for syntax change <iltzu@sci.invalid>
    Re: Suggestion for syntax change (Abigail)
    Re: Suggestion for syntax change <elephant@squirrelgroup.com>
        test <wangyin101@263.net>
    Re: Toronto, Canada: Junior-Intermediate Perl/CGI Softw (David H. Adler)
    Re: USEing a perl module <peter.sundstrom@eds.com>
        When to use for and foreach? <jcook@strobedata.com>
    Re: When to use for and foreach? (Tim Hammerquist)
    Re: When to use for and foreach? <care227@attglobal.net>
    Re: When to use for and foreach? (Craig Berry)
    Re: When to use for and foreach? <iltzu@sci.invalid>
    Re: Why won't  "use strict;"  work? <Petri_member@newsguy.com>
    Re: Why won't  "use strict;"  work? <flavell@mail.cern.ch>
    Re: Why won't  "use strict;"  work? (Hugh Lawson)
        WWW::Search Max returns <president@webticker.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Tue, 25 Jul 2000 12:33:29 -0700
From: chuckw <chuckwNOchSPAM@silverlink.net.invalid>
Subject: Reserved word
Message-Id: <00cc8300.97f89ff2@usw-ex0104-033.remarq.com>

Was just writing a module named "scrubber.pm" and consistently
got an:

Unquoted string "scrubber" may clash with future reserved word...

After much debugging and tracing, I can only assume that this is
one of the "official" perl reserved words. Is this true???


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

Got questions?  Get answers over the phone at Keen.com.
Up to 100 minutes free!
http://www.keen.com



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

Date: 25 Jul 2000 15:43:48 EDT
From: abigail@foad.org (Abigail)
Subject: Re: Reserved word
Message-Id: <slrn8nrrfe.vcg.abigail@alexandra.foad.org>

chuckw (chuckwNOchSPAM@silverlink.net.invalid) wrote on MMDXX September
MCMXCIII in <URL:news:00cc8300.97f89ff2@usw-ex0104-033.remarq.com>:
{} Was just writing a module named "scrubber.pm" and consistently
{} got an:
{} 
{} Unquoted string "scrubber" may clash with future reserved word...
{} 
{} After much debugging and tracing, I can only assume that this is
{} one of the "official" perl reserved words. Is this true???


No.


I guess you did something wrong. But, since you don't tell us what
you did, it's pointless to speculate.


Abigail
-- 
perl -wle '(1 x $_) !~ /^(11+)\1+$/ && print while ++ $_'


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

Date: 25 Jul 2000 15:47:59 EDT
From: abigail@foad.org (Abigail)
Subject: Re: Reserved word
Message-Id: <slrn8nrrn9.vcg.abigail@alexandra.foad.org>

Tony Curtis (tony_curtis32@yahoo.com) wrote on MMDXX September MCMXCIII
in <URL:news:87wviaateh.fsf@limey.hpcc.uh.edu>:
,, >> On Tue, 25 Jul 2000 12:33:29 -0700,
,, >> chuckw <chuckwNOchSPAM@silverlink.net.invalid> said:
,, 
,, > Was just writing a module named "scrubber.pm" and
,, > consistently got an:
,, 
,, > Unquoted string "scrubber" may clash with future
,, > reserved word...
,, 
,, > After much debugging and tracing, I can only assume that
,, > this is one of the "official" perl reserved words. Is
,, > this true???
,, 
,, You're confusing perl with the name of a potential pragma,
,, e.g. as in
,, 
,,     use strict;
,, 
,, Cap. the first letter, and all should be well
,, 
,,     use Scrubber;


Excuse me? If you make a file 'scrubber.pm', "use scrubber;" will work.
There's nothing special about the capatalized file names.

The name of file will not generate such an error.

But as I said before, there's no need to idle speculation. It only generates
postings like this.


Abigail
-- 
BEGIN {my $x = "Knuth heals rare project\n";
       $^H {integer} = sub {my $y = shift; $_ = substr $x => $y & 0x1F, 1;
       $y > 32 ? uc : lc}; $^H = hex join "" => 2, 1, 1, 0, 0}
print 52,2,10,23,16,8,1,19,3,6,15,12,5,49,21,14,9,11,36,13,22,32,7,18,24;


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

Date: Tue, 25 Jul 2000 20:06:30 GMT
From: nvp@spamnothanks.speakeasy.org (NP)
Subject: Re: Reserved word
Message-Id: <armf5.373613$MB.5921239@news6.giganews.com>

Jul 2000 12:33:29 -0700, chuckw <chuckwNOchSPAM@silverlink.net.invalid> wrote:
: 
: After much debugging and tracing, I can only assume that this is
: one of the "official" perl reserved words. Is this true???

Yes it is, along with box office failure ... "Flubber".  :-)

But seriously, it seems like you've got something misquoted or you're
trying to print out or declare something that's incorrect.  Sorry that
I'm writing this so gawkwardly; you can read a better description in
the perldiag man page.

Consider the following:

$ #1
$ perl -we 'print foo'
Unquoted string "foo" may clash with future reserved word at -e line 1.
Name "main::foo" used only once: possible typo at -e line 1.
Filehandle main::foo never opened at -e line 1.

$ #2
$ perl -we 'my %blah = (foo => bar);'
Unquoted string "bar" may clash with future reserved word at -e line 1.

-- 
Nate II


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

Date: 25 Jul 2000 15:13:39 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Reserved word
Message-Id: <87snsyaryk.fsf@limey.hpcc.uh.edu>

>> On 25 Jul 2000 15:47:59 EDT,
>> abigail@foad.org (Abigail) said:

> Excuse me? If you make a file 'scrubber.pm', "use
> scrubber;" will work.  There's nothing special about the
> capatalized file names.

> The name of file will not generate such an error.

> But as I said before, there's no need to idle
> speculation. It only generates postings like this.

Yes, you're right, I appear to have suffered a brain fart :-(

tony


-- 
"With $10,000, we'd be millionaires!"
                                           Homer Simpson


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

Date: Tue, 25 Jul 2000 12:17:27 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Search and delete
Message-Id: <MPG.13e787a1ac90824898abe8@nntp.hpl.hp.com>

In article <szhf5.2374$Gd1.28186@Typhoon.bART.nl> on Tue, 25 Jul 2000 
14:34:00 GMT, Eelke Kleijn <six4eight@NOSPAMhotmail.com> says...
> Never mind stoopid question I found it out already
> 
> <SNIP>

Then why didn't you share the answer with those who read your post, so 
they might avoid the same problem in the future?

perlfaq5:  "Why do I get weird spaces when I print an array of lines?"

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Wed, 26 Jul 2000 09:43:42 +1200
From: "Peter Sundstrom" <peter.sundstrom@eds.com>
Subject: Re: Sending email with attachment
Message-Id: <8ll1ms$bo$1@hermes.nz.eds.com>


Eelke Kleijn wrote in message ...
>
>"Eelke Kleijn" <six4eight@NOSPAMhotmail.com> schreef in bericht
>news:QPef5.2287$Gd1.27058@Typhoon.bART.nl...
>> Hi all,
><SNIP>
>>
>>I don't want to use a module, by the way.
>>
><SNIP>


But why would you not want to use a module?  Using MIME::Lite will make your
life very simple and it is easy to install anywhere you like as it only
consists of one file.




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

Date: Tue, 25 Jul 2000 12:14:03 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Simple Question?
Message-Id: <MPG.13e786d1a62e5bca98abe7@nntp.hpl.hp.com>

In article <slrn8nr4lu.d7d.tadmc@magna.metronet.com> on Tue, 25 Jul 2000 
09:14:38 -0400, Tad McClellan <tadmc@metronet.com> says...
> On Tue, 25 Jul 2000 08:39:21 -0500, Jerry Preston <g-preston1@ti.com> wrote:

 ...

> >I am trying the to use 'chmod' to change the permissions on an
> >directory.
> >
> >$j  =   chmod 0777 "/ki/";     The directory in question is 0775
> >
> >Where $j is always '0';  It had worked, but no luck now! I have read the
> >doc ..
> >
> >What am I  missing!  This seems so simple.  
> 
> 
> You are missing a check of the return value, and the consequent
> output of the $! variable:
> 
>    chmod 0777 '/ki/' or die "could not chmod '/ki/'  $!";

Errr, he's also missing a comma after 0777, to separate the arguments.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 25 Jul 2000 20:55:21 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Suggestion for syntax change
Message-Id: <964557132.20799@itz.pp.sci.fi>

In article <397DB72D.79F142A9@mindspring.com>, Keith G. Murphy wrote:
>Ilmari Karonen wrote:
>>
 [discussion about new list slice syntax snipped]
>>
>> In particular, if the third expression should be identical to the
>> first, should replacing 0 with a known-to-be-false variable make a
>> difference?  (It does for do/while.)
>> 
>I'm really having trouble understanding this.  Could you give a real
>code example?  The obvious example I can come up with is:

Consider the following examples:

  $ perl -le '$_ = 0; do {print} while ++$_ < 3;'
  0
  1
  2

This is an ordinary do/while loop.  The do block gets executed before
the condition is evaluated, so 0 is printed.

  $ perl -le '$_ = 0; 0 || do {print} while ++$_ < 3;'
  0
  1
  2

As far as perl is concerned, this one is identical to the previous
example.  Really identical.  The optimizer evaluates the constant part
of the expression at compile time, producing the exact same bytecode.

  $ perl -le '$_ = 0; $a || do {print} while ++$_ < 3;'
  1
  2

In this case, however, the optimizer can't be sure that $a might not
somehow acquire a true value, so the whole expression must always be
evaluated at runtime.  This, in turn, confuses the magic that looks
for single do blocks in the bodies of while-modified statements, so
that it treats this like a normal while loop, evaluating the condition
first.


And *this* is why I oppose, nay, loathe the idea of .. being magical
inside list slices.

-- 
Ilmari Karonen - http://www.sci.fi/~iltzu/
"The screwdriver *is* the portable method."  -- Abigail
Please ignore Godzilla and its pseudonyms - do not feed the troll.



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

Date: 25 Jul 2000 17:10:48 EDT
From: abigail@foad.org (Abigail)
Subject: Re: Suggestion for syntax change
Message-Id: <slrn8ns0ih.vcg.abigail@alexandra.foad.org>

Ilmari Karonen (iltzu@sci.invalid) wrote on MMDXX September MCMXCIII in
<URL:news:964557132.20799@itz.pp.sci.fi>:
,, 
,, Consider the following examples:
,, 
,,   $ perl -le '$_ = 0; do {print} while ++$_ < 3;'
,,   0
,,   1
,,   2
,, 
,, This is an ordinary do/while loop.  The do block gets executed before
,, the condition is evaluated, so 0 is printed.
,, 
,,   $ perl -le '$_ = 0; 0 || do {print} while ++$_ < 3;'
,,   0
,,   1
,,   2
,, 
,, As far as perl is concerned, this one is identical to the previous
,, example.  Really identical.  The optimizer evaluates the constant part
,, of the expression at compile time, producing the exact same bytecode.

That is a bug.

,, 
,,   $ perl -le '$_ = 0; $a || do {print} while ++$_ < 3;'
,,   1
,,   2
,, 
,, In this case, however, the optimizer can't be sure that $a might not
,, somehow acquire a true value, so the whole expression must always be
,, evaluated at runtime.  This, in turn, confuses the magic that looks
,, for single do blocks in the bodies of while-modified statements, so
,, that it treats this like a normal while loop, evaluating the condition
,, first.
,, 
,, 
,, And *this* is why I oppose, nay, loathe the idea of .. being magical
,, inside list slices.


Because of a *bug* in something completely different? That doesn't make
any sense at all.


Abigail
-- 
               split // => '"';
${"@_"} = "/"; split // => eval join "+" => 1 .. 7;
*{"@_"} = sub {foreach (sort keys %_)  {print "$_ $_{$_} "}};
%{"@_"} = %_ = (Just => another => Perl => Hacker); &{%{%_}};


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

Date: Tue, 25 Jul 2000 22:02:18 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: Suggestion for syntax change
Message-Id: <MPG.13e8abc2d42aa8af98968a@news>

Keith G. Murphy writes ..
>jason wrote:
>> 
>> Bart Lateur wrote ..
>> >jason wrote:
>> >
>> >>would there be many (any?)
>> >>situations where you'd be interested in going from index (x) to index
>> >>(Z-y) (where Z represents the length of the unknown LIST) ??
>> >
>> >Try skipping the first 2 items.
>> >
>> >       @rest = @somelist[2 .. -1];
>> >
>> >If you're talking about dropping a few items at the end: indeed, that
>> >would be rare.
>> 
>> that's an array .. not an unknown list .. you could just do
>> 
>>   @rest = @somelist[2..$#somelist];
>> 
>> but .. assuming you meant @somelist to represent an unknown LIST .. then
>> that's not enough of an example
>> 
>> I mean a real situation where you don't know the length of the list - or
>> how many items will be in it .. when would you want everything relative
>> to the end of an unknown list ??
>> 
>> I can think of HEAPS of situations in named LISTs (arrays) where you'd
>> want the last x elements .. or all but the first two elements .. but
>> those situations are already handled with $# (as in the example above)
>> 
>> I still contend that (LIST)[2..-1] should equate to (LIST)[2,1,0,-1] ..
>> and 2..-1 should equate to (2,1,0,-1)
>> 
>I have another argument against this interpretation, in addition to the
>"lists of unknown length" one, though I think that one's valid as well.
>
>If '[2..-1]' has the meaning '[2, 1, 0, -1]', 
>
>'foreach (2..-1) {something}'
>
>becomes a bit of a problem.  'something' is not done now; but '2..-1' by
>the "wraparound" interpretation would take on an obvious interpretation
>in the 'foreach' case as well, causing 'something' to be executed 4
>times, so there we'd have to make a choice between consistency and
>backward compatibility.  If we chose backwards compatibility, we'd have
>to keep explaining the inconsistency.

but the out of list index context behaviour is my main point .. it would 
often be very handy for the '..' operator to count down as well as up

  for(10..0) { print "Countdown: $_\n" }

a trivial example .. but I'm sure you get the idea .. the progression 
from 10..0 to 10..-1 is a natural one and it would seem obvious that you 
just keep counting down

it remains consistent with -10..-100 and such things .. and for THOSE 
useful interpretations of '..' I'm proposing to keep the same meaning in 
the list index context

but Bart's argument about the fact that before any evaluation of '..' is 
done in list index any negative arguments are just converted to relative 
indices from the end of the list is compelling

the main part of the behaviour that I want consistent is that '..' 
counts down when the first argument is larger than the second (and both 
are positive) .. so that things like

  (localtime)[2..1]

can be done .. as long as the special treatment is only for negative 
indices then I think it would work ok .. AND .. I think it's more 
consitent than what I originally proposed .. here's why...

essentially we're just debating about evaluation order .. -1 always 
means the index of the last element .. so if [2..-1] equates to [2,1,0,-
1] then it means that the '..' is done first and THEN the '-1' is given 
it's special meaning

the other (and I'm now thinking MORE consitent behaviour) is for '-1' to 
be interpreted first and THEN the '..' is evaluated so you get [2..-1] 
equating to [2..4] for a 5 element list .. then the '..' is done and you 
get [2,3,4]

I see that as very useful .. AND (thanks to Bart's explanation) more 
consistent

of course - out of a list index context '-1' has no special meaning .. 
so

  for(2..-1)

would equate to

  for(2,1,0,-1)

QED

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Tue, 25 Jul 2000 12:08:49 +0800
From: "wang yin" <wangyin101@263.net>
Subject: test
Message-Id: <8ljnhb$251o$1@news.cz.js.cn>






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

Date: 25 Jul 2000 20:31:58 GMT
From: dha@panix.com (David H. Adler)
Subject: Re: Toronto, Canada: Junior-Intermediate Perl/CGI Software Developer (up to  $55K) Perl, HTML/CGI, JavaScript
Message-Id: <slrn8nru9u.3gm.dha@panix6.panix.com>

On Fri, 21 Jul 2000 22:28:24 GMT, Matthew Pope <mpope@ematchcorp.com>
wrote:

>--------------73A2FA3BE8194D8B95C691E0
>Content-Type: text/plain; charset=us-ascii
>Content-Transfer-Encoding: 7bit

First, please don't do this.

>(We are a software company, <i>not</i> a recruiter.)&nbsp; [Netizens <i>please</i>
>excuse this brief commercial interruption...]</html>

Not only mime junk, but lots of html as well.  Please don't do that,
either.

Further,

You have posted a job posting or a resume in a technical group.

Longstanding Usenet tradition dictates that such postings go into
groups with names that contain "jobs", like "misc.jobs.offered", not
technical discussion groups like the ones to which you posted.

Had you read and understood the Usenet user manual posted frequently
to "news.announce.newusers", you might have already known this. :)

Please do not explain your posting by saying "but I saw other job
postings here".  Just because one person jumps off a bridge, doesn't
mean everyone does.  Those postings are also in error, and I've
probably already notified them as well.

If you have questions about this policy, take it up with the news
administrators in the newsgroup news.admin.misc.

There is a Perl Jobs Announce list that may be more helpful to you.  See
<http://www.pm.org/mailing_lists.shtml> for details.

Yours for a better usenet,

dha


-- 
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
"When the bug expands, I contract.  When it contracts, I expand.  And
when an opportunity appears, I do not fix the bug -- my keyboard does
it, on its own."	- Chip Salzenberg


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

Date: Wed, 26 Jul 2000 09:33:20 +1200
From: "Peter Sundstrom" <peter.sundstrom@eds.com>
Subject: Re: USEing a perl module
Message-Id: <8ll13k$vc1$1@hermes.nz.eds.com>


Tad McClellan wrote in message ...
>On Tue, 25 Jul 2000 13:57:57 +1200, Peter Sundstrom
<peter.sundstrom@eds.com> wrote:
>>
>>Glen Heide wrote in message ...
>>>What are the steps to making a perl file use a perl module?
>>>
>>>On the server I use (paid server), they don't have the MIME::Lite module,
>                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
>>>I have to install it myself... though I've been having no luck so far.
>
>>If you have set the path correctly in the "use lib", then everything will
be
>>fine (assuming of course, that the rest of your code has no bugs).
> ^^^^
> ^^^^
>
>
>Eh?
>
>The module is not installed.
>
>"use lib" isn't going to install the module.


Glen said that he has installed the module, but just can't use it.
Generally that means Perl can't find it.




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

Date: Tue, 25 Jul 2000 13:02:17 -0700
From: Jim Cook <jcook@strobedata.com>
Subject: When to use for and foreach?
Message-Id: <397DF249.3D37A69F@strobedata.com>

In the Camel book, the 'for' loop and the 'foreach' loop are initially
described differently. Later, it is said that "The 'foreach' keyword is
actually a synonym for the 'for' keyword, so you can use 'foreach' for
readability or 'for' for brevity."

Is there a coding standard which specifies the proper format for 'for'
and 'foreach?'

I have found that both loop formats work perfectly fine using either
'for' or 'foreach.' I would be inclined to use the first formats only,
and never the second ones.

------------------------ Prints 1-9 four times ------------------------
# perl -w
use strict;

for     ($_ = 1; $_ < 10; $_++) { print "$_ "; }
foreach (1..9)                  { print "$_ "; }

for     (1..9)                  { print "$_ "; }
foreach ($_ = 1; $_ < 10; $_++) { print "$_ "; }
------------------------------------------------------------

What are the opinions here? When would it be better to use 'for' or
'foreach?'


--
jcook@strobedata.com  Live Honourably    4/1 - 4/3 + 4/5 - 4/7 + . . .
2000 Tuesdays: Feb/last 4/4 6/6 8/8/ 10/10 12/12 9/5 5/9 7/11 11/7 3/14
Strobe Data Inc. home page   http://www.strobedata.com
My home page    O-           http://jcook.net


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

Date: Tue, 25 Jul 2000 20:14:48 GMT
From: tim@degree.ath.cx (Tim Hammerquist)
Subject: Re: When to use for and foreach?
Message-Id: <slrn8nrtqv.j6.tim@degree.ath.cx>

On Tue, 25 Jul 2000 13:02:17 -0700, Jim Cook <jcook@strobedata.com> wrote:
>Is there a coding standard which specifies the proper format for 'for'
>and 'foreach?'

It depends on your goal. Typing-wise (programmer efficiency), I prefer
C<for>. Maintainer Efficiency dictates syntax which provokes the fewest
tech support calls from clients, etc.  Check out the Efficiency section
in 'Programming Perl', 2nd Edition.

-- 
-Tim Hammerquist <timmy@cpan.org>

Emacs is a nice OS - but it lacks a good text editor.
That's why I am using Vim.  --Anonymous


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

Date: Tue, 25 Jul 2000 16:34:40 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: When to use for and foreach?
Message-Id: <397DF9E0.E8172757@attglobal.net>

[alt.what?]

Jim Cook wrote:
> 
> In the Camel book, the 'for' loop and the 'foreach' loop are initially
> described differently. Later, it is said that "The 'foreach' keyword is
> actually a synonym for the 'for' keyword, so you can use 'foreach' for
> readability or 'for' for brevity."
> 

This is one of those DWIMy things in Perl.  Based on the usage, Perl
can tell if you meant for or foreach, and will take the appropriate
action.  For the sake of clarity, use foreach when you mean foreach
and for when you mean for.


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

Date: Tue, 25 Jul 2000 21:15:27 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: When to use for and foreach?
Message-Id: <sns0rf7g3j1104@corp.supernews.com>

Jim Cook (jcook@strobedata.com) wrote:
: Is there a coding standard which specifies the proper format for 'for'
: and 'foreach?'

Generally, those who use both forms choose 'for' when using the C-like
init-test-increment syntax, and 'foreach' when using the list iteration
syntax.  E.g.,

  for (my $i = 0; $i < 10; $i++) {
vs.
  foreach my $val (@entries) {

But this is purely for notational clarity; as you pointed out, 'for' and
'foreach' are synonyms, and either may be used with either syntax.

This is similar to my recent discussion with Abigail regarding the choice
between map in a void context and foreach for looping over a list; it's a
matter of taste and style, though you can make cogent arguments either
way.  Note that here there isn't even the red herring of performance
differences between the options.

-- 
   |   Craig Berry - http://www.cinenet.net/users/cberry/home.html
 --*--  "Turning and turning in the widening gyre
   |   The falcon cannot hear the falconer." - Yeats, "The Second Coming"


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

Date: 25 Jul 2000 22:03:49 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: When to use for and foreach?
Message-Id: <964561707.28524@itz.pp.sci.fi>

In article <397DF249.3D37A69F@strobedata.com>, Jim Cook wrote:
>for     ($_ = 1; $_ < 10; $_++) { print "$_ "; }
>foreach (1..9)                  { print "$_ "; }
>
>for     (1..9)                  { print "$_ "; }
>foreach ($_ = 1; $_ < 10; $_++) { print "$_ "; }

The first two are the usual and recommended forms.  The third is also
common, because it saves typing.  The fourth form is just plain silly.


Heck, I hadn't even realized it worked before you posted this.  The
for(;;) syntax comes from C, and since C doesn't recognize "foreach",
using the longer keyword in Perl seems like deliberate obfuscation.

Like C, Java only understands the first form, but if it did support
the second form, you can be sure the last two would still be errors.

for(LIST) exists in Perl because of the laziness of Perl programmers;
foreach(;;) just shows it was shared by those who wrote the parser.

-- 
Ilmari Karonen - http://www.sci.fi/~iltzu/
"The screwdriver *is* the portable method."  -- Abigail
Please ignore Godzilla and its pseudonyms - do not feed the troll.



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

Date: 25 Jul 2000 08:31:14 -0700
From: Petri Oksanen <Petri_member@newsguy.com>
Subject: Re: Why won't  "use strict;"  work?
Message-Id: <8lkbs2$ofs@edrn.newsguy.com>

In article <slrn8npmf0.a3e.tadmc@magna.metronet.com>, tadmc@metronet.com says...

> Controlling variable scope is first-semester CS fodder,
> are you not a programmer?

>> I have no intentions of trying to become a professional
>> perl programmer.

> How about a professional programmer?

> How about even just "a programmer"?

> You must become a programmer if you are to write programs
> (that is the definition of "programmer").

Do you want to limit Perl to be the personal playtoy of a bunch of CS geeks
sitting around making theoretical solutions to theoretical CS problems?
Perl is for everyone who desires to use it.

Keep in mind;
Everyone can't have, or may not even have had the opportunity to pursue, a
degree in computer science.
Your remarks are unnecessary and insulting to every selftaught hacker out there.

Sure, the poor guy is a total beginner and has obviously chosen a far too
complex first project for himself, but that doesn't mean he needs to take grief
from you or anyone else for that fact.
Knowledge comes from learning, not from DNA, so everyone must have been a
beginner at some point. Even you.

Elitist comments like that are not helping the community, nor are they
encouraging people to join in and start using Perl.


Petri Oksanen



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

Date: Tue, 25 Jul 2000 21:21:51 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Why won't  "use strict;"  work?
Message-Id: <Pine.GHP.4.21.0007252112130.19901-100000@hpplus03.cern.ch>

On 25 Jul 2000, Petri Oksanen wrote:

> In article <slrn8npmf0.a3e.tadmc@magna.metronet.com>,
> tadmc@metronet.com says...

[..]
> > You must become a programmer if you are to write programs
> > (that is the definition of "programmer").
> 
> Do you want to limit Perl to be the personal playtoy of a bunch of CS geeks
> sitting around making theoretical solutions to theoretical CS problems?

Seems to be some kind of misidentification going on here.  
"programmer" does not mean "CS geek".  My official job title is
"physicist programmer", and I can assure you of that.  (We're the
people who write FORTRAN in any language, remember?).

> Perl is for everyone who desires to use it.

Indeed.  But by using it you become a programmer, whether you like it
or not.  So, embrace that fact and turn it to your advantage, instead
of trying to reject it.  Still doesn't mean you have to become a "CS
geek", or even play one on the MBone.

> Sure, the poor guy is a total beginner and has obviously chosen a far too
> complex first project for himself,

So you agree on the facts.  It's just the terminology that's a
problem.

> Knowledge comes from learning, not from DNA, so everyone must have been a
> beginner at some point. Even you.

Oh, shucks, do we have to go through this every time?  Nobody's born a
brain-surgeon, but if you want to do brain-surgery, then there are
certain pre-requisites before you are let loose.  Would it be
"elitist" to mention that?

> Elitist comments like that are not helping the community, 

I think you got the wrong end of the clue-stick.  After all, you
recognised that the hon. Usenaut had bitten off far more than he was
ready to chew.  Isn't that "elitist" too?




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

Date: Tue, 25 Jul 2000 20:42:51 GMT
From: hlawson@triad.rr.com (Hugh Lawson)
Subject: Re: Why won't  "use strict;"  work?
Message-Id: <slrn8ns03m.8np.hlawson@localhost.localdomain>

On Tue, 25 Jul 2000 21:21:51 +0200, Alan J. Flavell <flavell@mail.cern.ch>
wrote:

>I think you got the wrong end of the clue-stick.  After all, you
>recognised that the hon. Usenaut had bitten off far more than he was
>ready to chew.  Isn't that "elitist" too?

Making mistakes in selecting a new learning project is what beginners
often do, for if they could make good judgments about new projects, they
would already be beyond the beginner stage, and probably be good teacher
material as well.

So I think it's a good thing when those seeking help describe their
knowledge state as best they can.  Appropriate advice might sometimes take
the form of "I think you should try working on a more elementary form of
this project, something like this . . . [don't know enough to fill in the
ellipsis!]"

It takes two to make advice work.  One to give it, and the other to figure
out what to do with it.  In my humble position of "recovering newbie" who
hasn't yet mastered the llama book, I never even think about using a
module unless (1) it seems absolutely necessary, and (2) there is a
perfectly on-point example in the online documentation.

-- 
Hugh Lawson
Greensboro, North Carolina
hlawson@triad.rr.com



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

Date: Tue, 25 Jul 2000 15:46:48 -0400
From: Julian Cook <president@webticker.com>
Subject: WWW::Search Max returns
Message-Id: <397DEEA7.C0C03F7E@webticker.com>

Hello folks,..
Like a caveman discovering fire, I am awestruck by all the really kool
stuff I can do with these modules....

My question is about the WWW::Search module.
My code is below .............

#!/usr/local/bin/perl -w
use WWW::Search;
  my $oSearch = new WWW::Search('AltaVista'); ##see below
  my $sQuery = WWW::Search::escape_query("picard maneuver");
  $oSearch->native_query($sQuery);
  while (my $oResult = $oSearch->next_result())
    { print $oResult->url, "\n"; }


This works great for printing the first ten finds,..but I would really
like to
get more... I noticed in the documentation that there is a function of
the module that
can return max hits.... It's the part of the documentation that says....

$max = $search->maximum_to_retrieve(100);

Is there a way to use the maximum_to_retrieve component to give me more
links than the ten that show up?

Many thanks. When I first started posting to this group a few months ago
I was
a complete idiot and now, although still a complete idiot, I am so much
the wiser
using PERL.

Many thanks!
Julian Cook
president_at_webticker_dot_com

--
-----------------------------------------------------
My other car is a Garuda.....
-----------------------------------------------------




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

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 3802
**************************************


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