[9323] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2918 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jun 20 00:07:35 1998

Date: Fri, 19 Jun 98 21:00:28 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 19 Jun 1998     Volume: 8 Number: 2918

Today's topics:
    Re: ?CGI scripts & Explorer (-)
        A Script for checking emails valid? <oxygene@yoyo.cc.monash.edu.au>
    Re: A Script for checking emails valid? (John Stanley)
    Re: A Script for checking emails valid? <*@qz.to>
    Re: Apache and Perl _cmos@my-dejanews.com
        Array Elements <webmaster@dragonslist.com>
    Re: Beginner (Ron Barnhart)
    Re: Changing Computer Name/IP (-)
    Re: Copying an Anonymous Hash (Kevin Reid)
        Erasing password womlake@zip.com.au
    Re: Faster Search (-)
        Finding similar text files - an approach (Dan Lucas)
    Re: first language (Mark-Jason Dominus)
    Re: first language <johnmott_nospam_@home.com>
    Re: Flames.... <mpersico@erols.com>
    Re: Have we got a good free Perl manual? <mpersico@erols.com>
        Multiple pipes question <mongoose@mail.unlimited.net>
    Re: Multiple pipes question (John Stanley)
    Re: Multiple pipes question <rootbeer@teleport.com>
    Re: Regular Expression Question (Mark-Jason Dominus)
        removing multiples from an array <eugene@vertical.net>
    Re: removing multiples from an array <rootbeer@teleport.com>
    Re: Sick things to do in foreach loops <mpersico@erols.com>
    Re: String Puzzle. <rootbeer@teleport.com>
    Re: Subtracting Number of seconds from a date <mpersico@erols.com>
    Re: TELNET changing values of Timeout etc after they ha <jay@rgrs.com>
    Re: the ?PATTERN? match syntax (Kevin Reid)
    Re: Uploading perl scripts with a perl script. <rootbeer@teleport.com>
    Re: Why $foo? Why not $fool? <mpersico@erols.com>
    Re: Writing to a file on the same line (-)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Sat, 20 Jun 1998 00:56:59 GMT
From: root.noharvest.\@not_even\here.com (-)
Subject: Re: ?CGI scripts & Explorer
Message-Id: <358acd1a.233105049@news2.cais.com>

lr@hpl.hp.com (Larry Rosler) Said this:

>In article <358952ED.6CD8CB72@inlink.com>, perlguy@inlink.com says...
>> Actually there was NOTHING wrong with MY script that I was referring
>> to.  I DID contact Microsoft and their response was:
>> 
>> "We have no interest in fixing it because it is in an old version of the
>> browser."  (Version 3.02 & 3.03)

This is so sad.  A company that is so much more interested in revenues
than it is in keeping their current customers happy.  I mean,
especially coming from a company that is quick to proclaim their
benevolant concern for the customer and all that marketing blah blah.
They aren't interested in supporting the one browser that they've
published that actually has a significant market share, that's utterly
ridiculous.  Just take a look at how Novell does business.  They are
much more respectful of their clientelle, maybe even at expense to
their bottom-line.  I mean, it seems like they issue patches and bug
fixes to even Netware 3.12 even though they are currently pushing
"Intranetware".  They even continue to sell 3.12, although obviously
you wouldn't want to purchase it unless you had certain needs that
could not be addressed in 4.11 (like if you are connecting to certain
systems like the airline reservations systems, 3.12 or 2.2 seem to be
the only ones that work which is a problem in the reservation systems,
not Netware)

Unfortunately, as more and more of the "mass-consumer" class signs
onto the internet, Microsoft's disrespectful and harmful tactics will
become more and more acceptable.  

>
>> If I have to deal with dumbshit reasoning like that, I'd rather lose the
>> poor souls running Internet Exploder than have to jump through hoops to
>> get Microsofts software to work.
>> 
>> BUT, since I run a mixed browser extranet, and not all users could run
>> IE 4 (which worked), I did come up with a fix to the problem.  
>
>I also papered over a bug in MSIE 3, because I couldn't insist they 
>upgrade to MSIE 4.  Essentially our CGI code has to be tested on a 
>variety of clients (as well as, in my case, hosts -- HPUX and NT), which 
>is a great pain.

This is a big problem with MSIE.  It even goes as far as problems
between versions of their own browser.  Designers that had only
experienced their pages in 3.0 (and must have been too dumb to realize
that they needed to check their pages in other browsers) found that
once they upgraded to 4.0, their pages had all kinds of broken scripts
and other junk that they had jumped on from 3.0's whacky feature set.

>
>> Yes it WAS a problem with the browser and NO I don't see why *I* should
>> have to come up with creative solutions to program around Microsoft's
>> bugs, but the people who sign my paycheck wanted it done.
>
>This is my point.  I was willing to tell my customers who used the 
>FrontPage browser to use a real one, but I could hardly tell them to use 
>Netscape instead of M$ Explorer.  Yet that's what the glib responses here 
>tried to do.
>

Want to see some real problems, upgrade your server to apache 1.3b6
and implement the new style of "virtual hosts" - MSIE seems to have
real troubles with this, and it's not even a consistent problem, some
3.0's break, some 4.0's break, it's never the same version.  If you
have, say, "www.canonical.com" as your defualt server, and
"www.virtualhost.com" as a virtual host, some MSIE's will get confused
and when accessing www.virtualhost.com, will end up retrieving the URL
as if it were on www.canonical.com, which can be a big problem if they
don't share the same directory structure.

>
>I hope posters are getting the idea -- that real life now involves n * m 
>client-host combinations.  Standard protocols and quasi-portable 
>languages such as Perl help a lot.  "Use Unix" and "Use Netscape" don't 
>help at all.
>

But in the end, that is the only REAL solution.  Unfortunately, we
live in a time where non-technical people are making technical
decisions like which platforms, which software and which protocols to
support.  Just look at all the companies switching to NT, even though
any marginally trained network administrator can tell you NT is a
pandora's box of problems and outages.  But, the real solution is to
use what WORKS, not what some VP with a marketing background bought
into at the last circle-jerk meeting with their VAR.




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

Date: 20 Jun 1998 02:08:35 GMT
From: "Mr. Guy Gershoni" <oxygene@yoyo.cc.monash.edu.au>
Subject: A Script for checking emails valid?
Message-Id: <01bebb50$f0fddf60$520ac282@yakovk>

I am just wondering if anyone knows where I might be able to get a script
that will go through a list of emails and check that they still exsist.



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

Date: 20 Jun 1998 03:02:59 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: A Script for checking emails valid?
Message-Id: <6mf8p3$q76$1@news.NERO.NET>

In article <01bebb50$f0fddf60$520ac282@yakovk>,
Mr. Guy Gershoni <oxygene@yoyo.cc.monash.edu.au> wrote:
>I am just wondering if anyone knows where I might be able to get a script
>that will go through a list of emails and check that they still exsist.

Well, you need to describe the problem a little more than you have.
What is a "list of emails"? A list of message id's that refer to email
messages that might be in your inbox?  A list of filenames where you
stored email messages?

Or do you mean "list" as in the perl sense, where you actually have a
list of [email messages stored in a string], one email message per
string, several strings in the list? If this is the question, then you
really need to explain it, since if the email didn't exist, it wouldn't
be in the list in the first place.

You might be able to get a script that does any of these tests by giving
money to one or more of the people who post here and they will write it
for you. But you will need to explain the problem before they can do
it.



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

Date: 20 Jun 1998 03:21:23 GMT
From: Eli the Bearded <*@qz.to>
Subject: Re: A Script for checking emails valid?
Message-Id: <eli$9806192300@qz.little-neck.ny.us>

In comp.lang.perl.misc, Mr. Guy Gershoni <oxygene@yoyo.cc.monash.edu.au> wrote:
> I am just wondering if anyone knows where I might be able to get a script
> that will go through a list of emails and check that they still exsist.

INVISICLUES(TM)



1} Where can I get perl scripts?

  A) What do you need to use perl scripts?

  B) Don't read further until you have a computer.

  C) Have you tried examining the stuff on your computer?

  D) You have to turn it on first.

  E) You have to plug it in first.

  F) See, that wasn't so hard was it?



2} None of the scripts I have do what I want. Where can I get more?

  A) Where do perl scripts come from?

  B) People type them in.

  C) Don't read futher until you know perl.

  D) You could type one in too.



3} How can I learn perl?

  A) Perl comes with extensive documentation of the language.

  B) There are lots of hints in the FAQs.

  C) _Learning Perl_ and _Programming Perl_ are excellent references, too.



4} Okay, I know perl, but I don't know how to do this in perl. Help me.

  A) Usenet is a good place to ask questions.

  B) That didn't work so well, did it?

  C) Maybe you should have used a better subject.

  D) Read <URL:http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post>.

  E) Still getting flamed, huh?

  F) Maybe you should check to see if people have asked that question before.

  G) Have you tried reviewing the thread?

  H) Dejanews archives Usenet posts.

  I) Dejanews is at <URL:http://www.dejanews.com>.

  J) ASK DEJANEWS ABOUT <your question>


Elijah
------
making a template out of this


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

Date: Sat, 20 Jun 1998 02:30:43 GMT
From: _cmos@my-dejanews.com
Subject: Re: Apache and Perl
Message-Id: <6mf6sj$ij2$1@nnrp1.dejanews.com>

In article <6lvf9p$1e5k@r02n01.cac.psu.edu>,
  <p-lanphier@psu.edu> wrote:

Its only a 2 liner to get Perl running under Apache on Wintel - try that on
IIS.  I've done this on Win 95/NT/98 with IE 4 and Nav 4, all successfully.

The data's at the bottom of http://www.whom.co.uk/html/pcconf.htm

Basically once a directory is assigned as 'cgi' and aliased - the served file
behaviour is determined by the shebang to Perl and it all falls into place.

This was a lot easier than reading mod_Perl FAQ.


-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Sat, 20 Jun 1998 03:28:36 GMT
From: Sifu Hall <webmaster@dragonslist.com>
Subject: Array Elements
Message-Id: <358B2A74.F76CCC7A@dragonslist.com>

    Is there a function or subroutine that I can implement that will
tell me the number of columns in a multidimensional array?  Thank you
for your help.



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

Date: Sat, 20 Jun 1998 02:04:18 GMT
From: barnhart@freewwweb.com (Ron Barnhart)
Subject: Re: Beginner
Message-Id: <358b1790.1638633@news.smart1.net>

I'm also teaching myself Perl.  I purchased what most regard as the
Bible of Perl, Programming Perl.  I have also recently been given
advice that Learning Perl is also a great beginning book.  Both of
these are available from O'reilly.

I've also been told to make use of the documentation that comes with
your version of Perl, which also turned out to be good advice.  Hope
this helps.

Ron Barnhart
barnhart@freewwweb.com  

On Fri, 19 Jun 1998 15:20:15 +0200, "Sven Delmeiren"
<sdlmeire@mediaport.org> wrote:

>Hiya,
>
>>I'm in the process of trying to teach myself Perl.  If anyone has any
>>suggestions on where to start such as literature, etc.  I'd appreciate
>>it.
>>
>>thanks,
>>Chris Miller



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

Date: Sat, 20 Jun 1998 01:22:17 GMT
From: root.noharvest.\@not_even\here.com (-)
Subject: Re: Changing Computer Name/IP
Message-Id: <358b0eb5.249824756@news2.cais.com>

"Murtuza Chhil" <nrd1mmc@nrd.ups.com> Said this:

>Hi,
>Is it possible to change the IP address and computer name on a NT machine
>using perl....
>
>

Why, to help you with your spamming???




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

Date: Fri, 19 Jun 1998 23:48:15 -0400
From: kpreid@ibm.net (Kevin Reid)
Subject: Re: Copying an Anonymous Hash
Message-Id: <1davpp3.17hr7dt1aqhr28N@slip166-72-108-142.ny.us.ibm.net>

Craig Berry <cberry@cinenet.net> wrote:

> Sean McAfee (mcafee@qbert.rs.itd.umich.edu) wrote:
> : >Is there no way to do this without doing a key-by-key copy?
> : 
> : $h2 = { %$h1 };
> 
> No need for that anon-hash-ctor wrapper, which actually just wastes a
> whole lot of processing time to achieve exactly the same effect as
> 
>   $h2 = %$h1;

Shouldn't that be 

%$h2 = %$h1;

instead?

-- 
  Kevin Reid.      |         Macintosh.
   "I'm me."       |      Think different.


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

Date: Sat, 20 Jun 1998 12:23:54 +0100
From: womlake@zip.com.au
Subject: Erasing password
Message-Id: <358B9BCA.509@zip.com.au>

Here is what I want to do: (I've seen it done at several sites)
Step 1 ... Enter a password, submit it and proceed to next web page
Step 2 ... Press the back button on browser to return to password page
	   BUT with the password having been erased.
Can this be accomplished with Perl ?

Also is it possible using Perl to prevent someone from using the BACK
button to retrace steps in cgi scripted pages, thus preventing other
users from altering form settings ? 
Thanks,
Warren


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

Date: Sat, 20 Jun 1998 01:06:59 GMT
From: root.noharvest.\@not_even\here.com (-)
Subject: Re: Faster Search
Message-Id: <358b098b.248502642@news2.cais.com>

linberg@literacy.upenn.edu (Steve Linberg) Said this:


>Build an index.
>This is not really a Perl question, btw.

Yes it is though.  Sure, your answer isn't really a perl answer, it's
a database answer, but the question is how to make a perl search
faster.  And building an index doesn't really answer the question.
All it does is show that you feel the need to attempt to make yourself
look like you know what you're talking about.


Trying to make perl search a series of files faster isn't exactly
going to be easy.  if you were talking about database tables, then an
index would work great - I have a script that searches a database from
a music distributor, containing over 150,000 records.  To make it
faster, I created an index the hard way, by opening the file and then
writing the exact byte location for each line of the file to an
"index" file.  So, then I could use seek statements in the search
program.  However, I don't believe you can do this with a script that
is doing "full text retrieval" types of searches, opening and reading
each file in a directory (especially if those files are changing at
all)

however, perhaps you should just get away from perl altogether and try
using Wais, which really is the better tool for this job.

You could also try to streamline your program a little, although the
actual opening and closing of files will still be your bottleneck, at
least you'll spend less time between each line and each file doing all
kinds of intricate comparisons and split()'s and so forth.  Minimize
the actions you place on each loop within your script, and that might
help.




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

Date: Sat, 20 Jun 1998 03:17:12 GMT
From: dlucas@deletethis.gol.com (Dan Lucas)
Subject: Finding similar text files - an approach
Message-Id: <358b2c72.63556409@nnrp.gol.com>


I have a need to find duplicate text files in a folder. The catch is
that they will not be identical, just very similar; essentially these
represent email 'clippings' from sources such as the newswires. Thus,
while the opening and closing few lines may be different, the 'body'
is often substantially the same.

Using Perl, I thought of checking for duplicates by doing something
like:

1) Open file1 as one string
2) Select 10 strings of 5 words at random from body of file, stripping
punctuation and \n, and putting them into an array
3) Open file2 as one string
4) foreach through the array containing the 10 strings from file 1
attempting to match each one
5) If more than 80% hit ratio, do something (print out file names,
move files etc.)

This approach seems to me to be worth trying, but does anyone have any
comments on efficiency/effectiveness before I start?

Dan



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

Date: 19 Jun 1998 21:03:04 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: first language
Message-Id: <6mf1o8$nc4$1@monet.op.net>


In article <MPG.ff47c2f250e4d769896ae@nntp.hpl.hp.com>,
Larry Rosler <lr@hpl.hp.com> wrote:
>Dominus said:
>> `scanf' cannot modify variables in the calling subroutine without
>> pointers because the variables are lexically scoped so that they can
>> be hidden from other subroutines.
>
>No, that is not the reason at all.  Scanf cannot modify argument 
>variables *anywhere* because of C's intractable call-by-value semantics.  
>In order for a C function to modify any of its arguments, the argument 
>must be a pointer to the actual lvalue to be modified.  This is 
>independent of the scope of that lvalue.

lvalues do not have scope.  Only names have scope.

In any event, it is irrelevant to this discussion.  Consider a
language that supports both call-by-value and call-by-reference
semantics, say Pascal.  You will have to explain to the students why
one and not the other must be used in a case like this, and the
explanation will be nearly identical to the explanation of why scanf
arguments are preceded by & in C.  So pedagogically, there is very
little difference between these two things.  

You can either present it as an opaque incantation (`put var before
the formal parameter' / `put * before the formal parameter and &
before the actual parameter') or you can explain what is really going
on and why.  But what is really going on, and why, is exactly the same
in both cases.  So the call-by-value semantics are a red herring here;
they don't change the teaching order or the presentation at all.

>As you know, arrays are passed as pointers, which leads beginners to all 
>kinds of confusion between a[N] (which allocates storage) and *a (which 
>points to storage -- one hopes!).

My students were not confused by this.  

>Well, I think I really do understand pointers and can teach them the 
>right way.  

And yet you say that your students were confused about all sorts of
things.  Surely this is inconsistent?

>But I think they introduce concepts of physical address way too soon
>for programmers who are trying to learn their first "higher- level"
>language.

I did not discuss physical addresses at any point.  In fact, I
conceived a crazy theory at the beginning of the semester that
physical address explanations were totally unnecessary, in spite of
having seen such explanations in nearly every C book I had ever read.

I resolved to see if I could get through the whole class without every
mentioning a physical address.  I was successful in this.  It turned
out to be a brilliant inspiration.  I think that people who discuss
physical addresses are making a big mistake.  Physical addresses are
irrelevant in a high-level language.

>Pointers are needed only for allocated storage, not for named storage in 
>any scope.  I think learning them should be delayed until necessary, 

I agree, but I believe that in C, they are necessary right away.

Chapter 5 of K&R notwithstanding, pointers are not a single topic.
There are a lot of things to do with pointers.  You need them for
scanf.  You need them for passing arrays to functions.  You need them
for address arithmetic on arrays.  You need them for dynamically
allocated storage.

Surely the most ordinary principles of pedagogy would suggest that you
*don't* try to cover all of these things at the same time, but rather
one at a time, starting with the simplest, moving from each to the
next only when the students are comfortable?

>Summary:
>My *real* choice for a first language for students who want to become 
>"real" (i.e., professional) programmers would be an abstract assembly 
>language such as MIX (Knuth, vol. 1).

That is very interesting.  I am skeptical, but I am very eager to hear
you recount your experiences if you have actually done that.

If your main point is that C is a bad first language to teach
programmers, you will not get much argument out of me.  I agree with
you.  All I am saying is that it can be taught more successfully than
it usually is.



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

Date: Sat, 20 Jun 1998 03:02:58 GMT
From: John Mott <johnmott_nospam_@home.com>
Subject: Re: first language
Message-Id: <358B24FE.4FF410FD@home.com>

Larry Rosler wrote:

> burden.
> 
> Summary:
> 
> My *real* choice for a first language for students who want to become
> "real" (i.e., professional) programmers would be an abstract assembly
> language such as MIX (Knuth, vol. 1).  With that as a basis, the C
> concept of pointers becomes transparent.
> 

Although I have never taught programming I certainly had to learn it :-)

My first language was FORTRAN, because I was in physics. 
Looking back, the good things about it were call by reference and (at
that
time with Fortran IV) heavy emphasis on the GOTO. This made for sloppy
code
but it also made the first steps easier to take. It was also easier to
not
have to declare variables. This is all heresy, of course, but for me the 
essence of learning programming is learning about what happens as you
are 
rewiring your brain so that you take a problem and translate it into
action.
In those first awkward stumbles a language that was more primitive was
better.
As I matured and took other languages was able to abstract the
importance
of structure, declarations, etc. because I had legs to stand on. 

I also remember that it took me three solid weeks of staring at my
Pascal book 
before I got pointers; it was a very painful time because the notion was
introduced in a 
vaccum. Had I been thrown this as a tool that was needed for a specific
task its likely 
that I would have (like many other programming lessons) just sort of
used them for a long
time until the 'AHA' moment hit and I popped to the meta-level where I
saw purpose.

John Mott
john@sandh.com
http://www.iplsystem.com/	; A darn nice language for the web. It would
be good for teaching, too!


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

Date: Fri, 19 Jun 1998 23:50:04 -0400
From: "Matthew O. Persico" <mpersico@erols.com>
Subject: Re: Flames....
Message-Id: <358B316C.C474A98A@erols.com>

1) Take it as a sign of respect that people would expect to get
instantaneous answers to any question. They wouldn't ask if they thought
the readers of the group were incompetent or unwilling to help.

2) Telling someone to FAQ, with maybe a specific section, and a gentle
admonition to go and sin no more is perfectly accepatble.

3) Screaming, ranting and going postal is just rude. And even if you
consider some nebie FAQ'able questions to be rude, why do you stoop to
that level?

How about the "Standard RTFFAQ" clause:

<STD_RTFFAQ>
Fellow programmer,
You have asked a question that can be answered by examination of the
documents that come with the Perl distribution:

<optional> To wit, document <doc name>, section <secname> should answer
your question. </optional>

In order to make this group as useful and full of information as
possible, we strive to keep the easy questions (defined as those
answerable elsewhere) to a minimum, leaving time, bandwith and brain
power to answer the hard ones.

In the future, please take the time to peruse the documents fully before
posting a question. The bandwith you save may be yours. And it has
happened that while reading the docs for one answer, multiple facts have
been learned.

Thanks.
</STD_RTFFAQ>

Now, surely any decent mailer can include that file from your disk in
your response. Even saves you the carpal-tunnel you get from ponding a
keyboard in anger.

A little bit of courteousy goes a long way.


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

Date: Fri, 19 Jun 1998 23:01:41 -0400
From: "Matthew O. Persico" <mpersico@erols.com>
Subject: Re: Have we got a good free Perl manual?
Message-Id: <358B2615.992A671B@erols.com>

My $0.02

Larry gave us Perl. Free. So a few people (including Larry maybe?) want
to make a few bucks describing it to the rest of us. More power to 'em.
People have to eat.

It's not like we're talking Mr. Bill here who charges us for the
software, make you print out the help on your own paper for manuals,
forcing you to buy a "Dummies" book to get anywhere.


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

Date: Fri, 19 Jun 1998 19:59:33 -0700
From: "Joshua Swink" <mongoose@mail.unlimited.net>
Subject: Multiple pipes question
Message-Id: <6mf8el$amu$1@supernews.com>

I have a problem with a program I want to write, I'd appreciate help with
this.

Suppose you want to write a MUD client.  It connects to a MUD and
receives text, and sends the user's commands to the mud.

  It is receiving, processing, and displaying text from the MUD,
  And receiving, processing, and displaying commands from the user..

Problem is, if you want to check for user input, the program stops
until there IS user input.

Conversely, if you check for text from the MUD, the program stops
until there IS text from the MUD.

So I can't even get started, basically.  Anyone know how to work
around this?

Thanks




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

Date: 20 Jun 1998 03:04:31 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Multiple pipes question
Message-Id: <6mf8rv$qbt$1@news.NERO.NET>

In article <6mf8el$amu$1@supernews.com>,
Joshua Swink <mongoose@mail.unlimited.net> wrote:
>Problem is, if you want to check for user input, the program stops
>until there IS user input.

The four parameter select is your friend.




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

Date: Sat, 20 Jun 1998 03:28:31 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Multiple pipes question
Message-Id: <Pine.GSO.3.96.980619202712.2666J-100000@user2.teleport.com>

On Fri, 19 Jun 1998, Joshua Swink wrote:

> Problem is, if you want to check for user input, the program stops
> until there IS user input.

Sounds as if you want non-blocking input; see the four-argument form of
select. Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 19 Jun 1998 22:47:18 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Regular Expression Question
Message-Id: <6mf7rm$nqi$1@monet.op.net>

In article <eli$9806191350@qz.little-neck.ny.us>,
Eli the Bearded  <*@qz.to> wrote:
>For perl on Unix, you might want to use <*.c> type constructs to do
>globbing, but perl won't let you put a variable in there, so you have
>to use eval.

You can use the `glob' function:

	$pat = (something that gets user input from somewhere);
	@files = glob($pat);


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

Date: Fri, 19 Jun 1998 22:49:23 -0500
From: Eugene Sotirescu <eugene@vertical.net>
Subject: removing multiples from an array
Message-Id: <358B3142.EA6CA985@vertical.net>

How would I go about removing multiples from an array?
For ex, if the array elements are 123.html 345.html 567.html 123.html
678.html 123.html 678.html
then after removal it should be
123.html 345.html 567.html 678.html

Thanks.



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

Date: Sat, 20 Jun 1998 03:26:35 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: removing multiples from an array
Message-Id: <Pine.GSO.3.96.980619202521.2666I-100000@user2.teleport.com>

On Fri, 19 Jun 1998, Eugene Sotirescu wrote:

> How would I go about removing multiples from an array?

I think you mean duplicate entries. See the FAQs entry on "How can I
extract just the unique elements of an array?" Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 19 Jun 1998 23:33:18 -0400
From: "Matthew O. Persico" <mpersico@erols.com>
To: Peter Scott <psf@euclid.jpl.nasa.gov>
Subject: Re: Sick things to do in foreach loops
Message-Id: <358B2D7E.BB1A6B36@erols.com>

Peter Scott wrote:
>
> [snip]
>
> I had a reason to want to extend the list in a foreach loop, and
> to my pleasant surprise, I found that I could actually push elements
> onto the end of the list while in the loop and still have the loop
> iterate over them.  It's not clear to me that this would be implied
> by the fact that the loop element was an alias for the actual list
> element.  

W/O looking at the source, I figure that when the foreach statement is
parsed, the list is evaluated and then represented in memory someplace.
The iterator variable deep down in the implementation is just a pointer
to one of the list elements. Presumably, the list has an end-of-list
marker. Each time you push another element onto it, you just move the
marker. Voila! You loop does a Timex.

Now, the implementation you expected was a bounds check of the iterator
variable against the known limit of the array when the statement was
parsed. Seems to me to be too much work. I wouldn't have done it that
way. Remember, in Perl, this is a foreach over a list, not a 'C' for. 

A 'C' for has a condition to check which 99/100 [sic] is some counter
reaching some limit. But hey, you can screw that up in C too:

for ( i = 0; i != 100; i++) {
    if(i==99) {
        i = 101; /* ;-) */
    }
}

There is nothing magical about loop/array bounds.


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

Date: Sat, 20 Jun 1998 03:19:29 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: String Puzzle.
Message-Id: <Pine.GSO.3.96.980619201725.2666F-100000@user2.teleport.com>

On Fri, 19 Jun 1998, Dave Lorand wrote:

>   @chunks = split /(<[^>]*>)/, $text;
> 
> The pattern in the split matches any html tag.  

No, it doesn't!

    <img src="rtarrow.gif" alt= "-->" >

To do this properly, you need to parse HTML. This is easy to do with, for
example, HTML::Parser from CPAN. Hope this helps! 

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 19 Jun 1998 23:37:13 -0400
From: "Matthew O. Persico" <mpersico@erols.com>
To: Matthew Robertson <mat.r@ukonline.co.uk>
Subject: Re: Subtracting Number of seconds from a date
Message-Id: <358B2E69.C5D7D319@erols.com>

How 'bout posting the solution?

Matthew Robertson wrote:
> 
> The problem has been solved now.
> 
> Thanks to everyone for their help
> 
> Mat


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

Date: 19 Jun 1998 23:28:36 -0400
From: Jay Rogers <jay@rgrs.com>
To: john.kelly@citicorp.com
Subject: Re: TELNET changing values of Timeout etc after they have been set?
Message-Id: <8290mswy3f.fsf@shell2.shore.net>

john.kelly@citicorp.com (John Kelly) writes:
> 	 Is there a way to change the values of Timeout, and prompt in
> your code after they have been set established with new 
> i.e.   $rem_node= new Net::Telnet (Timeout => 10, Prompt =>'/\$ $/') ;

All this and more is described in the man page for Net::Telnet.

    $rem_node->timeout(5);
    $rem_node->prompt('/bash\$ $/');

--
Jay Rogers
jay@rgrs.com


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

Date: Fri, 19 Jun 1998 23:48:12 -0400
From: kpreid@ibm.net (Kevin Reid)
Subject: Re: the ?PATTERN? match syntax
Message-Id: <1davkon.c6zek143v8y2N@slip166-72-108-142.ny.us.ibm.net>

Jonathan Feinberg <jdf@pobox.com> wrote:

> mjd@op.net (Mark-Jason Dominus) writes:
> 
> > When is ?...? useful?  What do you do with it?
> 
> It's terrific for obfuscation.
> 
> #!/usr/bin/perl -w --                     Just another Perl hacker,
> (open 0),$_=<0>,s,.*- +,,,chop;for(split?@*?){($$_++or$}=$_,y,y \,\
> y,<STDIN>,,$$=~s\^\"sub $_ {print'$}'};7"\ee),y,} \,},>STDOUT,,&$_}

Thanks for showing me another obfuscation trick (open 0).

open+0;print<0>

(15 chars) is an improvement over

open H,$0;print<H>

(18 chars).

#!perl -w-e'seek DATA, 0, 0; print <DATA>'
$_=q;\;0+nepo; ;$_?$_:$!=s;^(.*)$;(join+q..,
reverse+split+m++,$1).q.print<0>.;see? 00:01

-- 
  Kevin Reid.      |         Macintosh.
   "I'm me."       |      Think different.


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

Date: Sat, 20 Jun 1998 03:14:50 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Uploading perl scripts with a perl script.
Message-Id: <Pine.GSO.3.96.980619201324.2666D-100000@user2.teleport.com>

On Fri, 19 Jun 1998 rpearce@my-dejanews.com wrote:

> CGIwrap Error: System Error: execv() failed

That's not a Perl error message; it looks as if it's coming from CGIwrap.
I recommend you check the docs, FAQs, and newsgroups relating to CGI
scripting and CGIwrap in particular. Good luck!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Fri, 19 Jun 1998 23:08:49 -0400
From: "Matthew O. Persico" <mpersico@erols.com>
Subject: Re: Why $foo? Why not $fool?
Message-Id: <358B27C1.BADA1CC@erols.com>

> they are syllables of the word "fubar"

which is US Army slang for "F--ked up beyon all recognition". Much like
snafu is :"Situation nominal (normal), all f--ked up".


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

Date: Sat, 20 Jun 1998 01:15:39 GMT
From: root.noharvest.\@not_even\here.com (-)
Subject: Re: Writing to a file on the same line
Message-Id: <358b0cb2.249309455@news2.cais.com>

Ying Peng <peng@cae.cig.mot.com> Said this:

>Yasir:
>
>I am sorry to ask you a related question instead. My question is how to
>write $in{XXX}
>data into a file. I received an error message from the Web.
>
>Suppose users fill out a web form containing
>
>reqname
>reqdate
>:
>:
>
>in request.cgi:
>
>open(OUTFILE, ">/tmp/webinf");
>print OUTFILE "$in{reqname}\n";
>print OUTFILE "$in{reqdate}\n";
>:
>:
>close OUTFILE;
>
>The above script doesn't work for me. I might miss some points. It gave
>me the following error messages:
>

You need some kind of library or module file that you call in the
beginning of your script to parse the form data.  

a few worth looking into are:

cgi-utils.pl - the easiest one to use, but most people will say not to
use it since it's not as new and exciting as some of the others.

cgi.pm - the "best one", but probably overkill for just getting form
data, IMHO.

cgi-lib.pl - a little more "clunky" but still works rather well

Start looking around the CPAN to find the module or library that works
best for you:  http://www.cpan.org/




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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 2918
**************************************

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