[11026] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4626 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jan 12 02:07:30 1999

Date: Mon, 11 Jan 99 23:00:18 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 11 Jan 1999     Volume: 8 Number: 4626

Today's topics:
    Re: [Q] How use Cookie? <thomas@daimi.au.dk>
    Re: cgi - log and html re: (Andre L.)
        CGI.pm Warnings <neiled@enteract.com>
        grep with boundaries and regex (Jason Q.)
    Re: How can I compare two arrays? (Abigail)
    Re: How can I compare two arrays? (Abigail)
    Re: looking for perl programmer <thomas@daimi.au.dk>
        Making perl do tasks at specific times.. (FirstAGYG)
    Re: parsing URL query strings (Abigail)
    Re: Perl Criticism <ljz@asfast.com>
    Re: Perl Criticism (David Formosa (aka ? the Platypus))
    Re: Perl Criticism (Sam Holden)
    Re: Perl Criticism (Sam Holden)
    Re: Perl Criticism (David Formosa (aka ? the Platypus))
    Re: Perl Criticism (David Formosa (aka ? the Platypus))
    Re: Perl Criticism (David Formosa (aka ? the Platypus))
    Re: Perl Criticism (Sam Holden)
    Re: regexp across multiple arrays, that aren't alike... (Ilya Zakharevich)
    Re: regexp across multiple arrays, that aren't alike... <ebohlman@netcom.com>
        Socket in Perl - help?????? <wtsai@ms.chttl.com.tw>
    Re: Socket in Perl - help?????? (Fluffy)
    Re: URGENT: Array of arrays... (Tad McClellan)
    Re: What is $1 ??? (Tad McClellan)
    Re: Year 2038 problem (Abigail)
    Re: Year 2038 problem (Abigail)
    Re: Yet another REGEX question <death@N-O-S-P-A-M.solaris1.mysolution.com>
    Re: Yet another REGEX question (Abigail)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Tue, 12 Jan 1999 07:12:07 +0100
From: Thomas Jespersen <thomas@daimi.au.dk>
Subject: Re: [Q] How use Cookie?
Message-Id: <369AE7B7.C374F95A@daimi.au.dk>

HongMo wrote:
> 
> Example please.........
> 
> ^^;

decius:...thomas% perldoc -f Cookie
No documentation for perl function `Cookie' found

I am sorry, my copy of perl does not know that function

-- 
Thomas Jespersen, thomas@daimi.au.dk
Lotus Notes / Domino Developer @ http://www.lavasoft.dk
Student @ http://www.daimi.au.dk


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

Date: Tue, 12 Jan 1999 00:08:47 -0500
From: alecler@cam.org (Andre L.)
Subject: Re: cgi - log and html re:
Message-Id: <alecler-1201990008470001@dialup-698.hip.cam.org>

In article <369A742D.51180716@vossnet.de>, heli@vossnet.de wrote:

[...]

> the log-part works well - the giving back html-part to mozilla also
> works well - as long as i don't use any var's like HTTP_USER_AGENT,
> REMOTE_HOST. etc. then i get one of these _document contains no data_
> cgi errors :( am i just too stupid or does it just work on an unix-sys?

[...]

> # error must be in the following line
>         print 1 "$ENV{HTTP_USER_AGENT}\n";

Look at the filehandle in this line.

Andre


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

Date: Mon, 11 Jan 1999 23:15:13 -0600
From: "Neil Edmondson" <neiled@enteract.com>
Subject: CGI.pm Warnings
Message-Id: <77elqk$kid$1@eve.enteract.com>

I'm trying to clean up my error logs, I get a lot of this warning, why?

[Mon Jan 11 22:46:40 1999] member_v1.pl: Ambiguous use of values => resolved
to "values" => at member_v1.pl line 862.
[Mon Jan 11 22:46:40 1999] member_v1.pl: Ambiguous use of values => resolved
to "values" => at member_v1.pl line 865.
[Mon Jan 11 22:46:40 1999] member_v1.pl: Ambiguous use of values => resolved
to "values" => at member_v1.pl line 890.

Here's some of the code

sub Validate_Customer {
        my ($CGI,$customerdb,$update) = @_;
        # $update = false means this is an "add" so check for pre-existence
of user
        my @error;
        my $nc = $CGI->param('first');
        my $uc = "\u$nc";
        $CGI->param(-name=>'first', -values=>$uc);  #<<<<LINE # 862
        $nc = $CGI->param('last');
        $uc = "\u$nc";
        $CGI->param(-name=>'last', -values=>$uc); #<<<<LINE # 865

        push (@error, "First name required") if (!$CGI->param('first'));
        push (@error, "Last name required") if (!$CGI->param('last'));

        etc. etc

I'm also using

 unshift(@INC, "../CommonModules/CGI.pm-2.43");




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

Date: Tue, 12 Jan 1999 06:50:49 GMT
From: pigs_can_fly@mindless.com (Jason Q.)
Subject: grep with boundaries and regex
Message-Id: <369ceb52.24440256@news.cyberway.com.sg>

Hi,

>From @temp, I need to grep $word, which might be "=F".

It works fine with this line,

@temp = grep(/$word/,@temp);



However, when I want to restrict to only whole word greps using this:

@temp = grep(/\b$word\b/,@temp);

it fails to identify "=F"

I suppose it's due to the \b and think I need to specify $word as a
regex because of the "=".

How do I achieve this?


Thanks



JQ


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

Date: 12 Jan 1999 00:02:07 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: How can I compare two arrays?
Message-Id: <77e3dv$5b9$1@client3.news.psi.net>

Larry Rosler (lr@hpl.hp.com) wrote on MCMLIX September MCMXCIII in
<URL:news:MPG.1103bebafa20451b989986@nntp.hpl.hp.com>:
%% 
%% 
%% Hash access is indeed O(1) -- constant independent of the size of the 
%% hash.  (If the hash is quite full, there may be some linear effects due 
%% to chaining of entries -- the details depend on how the hash is 
%% implemented, which for perl I don't know.)

You cannot garantee O (1). Worst case insertion/query time is Omega (n).
"Linear effects" due to chaining don't have to do with the hash being
full, but with many keys hashing to the same bucket. When the hash is
getting 'full', you will get an insertion that takes linear time (even
if all the keys mapped to a different bucket), as the hash needs to be
rebuild.



Abigail


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

Date: 12 Jan 1999 00:06:42 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: How can I compare two arrays?
Message-Id: <77e3mi$5b9$2@client3.news.psi.net>

Randal L. Schwartz (merlyn@stonehenge.com) wrote on MCMLIX September
MCMXCIII in <URL:news:m11zl1fzps.fsf@halfdome.holdit.com>:
:: >>>>> "Larry" == Larry Rosler <lr@hpl.hp.com> writes:
:: 
:: Larry> The time needed to create the hash is O(n), obviously.
:: 
:: Not so obviously. :) I suspect that the time needed to create the hash
:: actually goes up a bit as the size increases.  Perhaps O(n**1.5) or
:: so.  The problem is when you get to a full hashbucket, you have to
:: rebucket the entire hash.  (Or at least that's how I understand it.)
:: 
:: *Access* time is reasonably constant, regardless of the size of the
:: hash, however.

If the access maintains constant (that is, no slowdown due to chaining)
the total insertion time is still bounded by O (n), because the size of
the hash increases with a fraction. However, certain insertions take
Omega (n) time. 

I've no idea where O (n sqrt (n)) comes from.

:: I think abigail did some benchmarks on this once.

I don't think so.



Abigail


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

Date: Tue, 12 Jan 1999 07:46:25 +0100
From: Thomas Jespersen <thomas@daimi.au.dk>
Subject: Re: looking for perl programmer
Message-Id: <369AEFC1.DDF2B65F@daimi.au.dk>

TRG Software wrote:
> 
> - Dan
> www.parplex.com (main page)
> www.parplex.com/bigsoft/ ( my web page)

Well, if you think this guys emails are hilarious visit his web page.

Quotes:

"Welcome To Think BIG, Big Programing Web Site!" (headline for the page)

"Today is: Tuesday, January 12, 1999 Very Nice day Hu?"

"I would like to welcome you to my programing web page this site will be
filled with LOTS and LOTS of great information on programing and how
to's  Lots of Sample Code and Sample coding and how to get started
understand how a programing lang works ill try my best to make this site
the best site but the only way i can do this is if you send me imput and
feed back please Email me Click here! or that is: bigsoft@parplex.com"

(if anybody can find this great information, please tell me where, I
could not find any links to it!)

"Think Smart, Think BIG! - Big Software) Corp."

-- 
Thomas Jespersen, thomas@daimi.au.dk
Lotus Notes / Domino Developer @ http://www.lavasoft.dk
Student @ http://www.daimi.au.dk


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

Date: 12 Jan 1999 05:51:33 GMT
From: firstagyg@aol.com (FirstAGYG)
Subject: Making perl do tasks at specific times..
Message-Id: <19990112005133.07277.00011762@ng113.aol.com>

Hello, im fairly new to the group and Perl itself. I have 2 perl books, and i
cant seem to find any info on how to schedual perl to do things at specific
times, without any intervention from me or a user. Does anyone know of the
tecnique? Thanks a bunch.

John


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

Date: 12 Jan 1999 00:17:35 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: parsing URL query strings
Message-Id: <77e4av$5b9$5@client3.news.psi.net>

geoff@logix.com (geoff@logix.com) wrote on MCMLIX September MCMXCIII in
<URL:news:369a73cd.6021135@area1.news.internex.net>:
;; Anyone know how I can parse a query string passed to my script via a
;; link??

perldoc CGI



Abigail


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

Date: 11 Jan 1999 23:31:33 -0500
From: Lloyd Zusman <ljz@asfast.com>
Subject: Re: Perl Criticism
Message-Id: <ltyan9m7ru.fsf@asfast.com>

TRG Software <chatmaster@c-zone.net> writes:

> topmind@technologist.com wrote:
> > 
> > [ ... ]
> >
> > "There is a saying in the Unix community that one should not
> > prevent idiots from abusing something because it may prevent
> > someone else from making good use of it. [ ... ] Thus, I
> > unfortunately have to disagree with the "Unix Chain-saw" rule."
> 
> [ ... ] 
> *Anything* in this world can be abused, and if you can't learn to use it
> properly yourself, or don't retain the proper comprehension,. then don't
> blame us or the language.

After browsing a bit through this thread, I want to offer my two
cents' worth:

First of all, I'm not in favor of protecting people against themselves
against their wills, especially with regard to programming languages.
There are plenty of languages for people to choose from, and people
will tend to gravitate towards those languages which suit them best.
I see no reason to change an existing, very useful and widely used
language just to make it more palatable to certain people who could
easily find several other languages that the are more comfortable
with.

And I want to ask the following question to those who seem to be
concerned about this "Unix Chain-saw rule":

What kind of damage do you believe can be done using Perl that cannot
be done with a "cleaner" language?  Are you just referring to
productivity losses by novices struggling to figure out how to use
Perl, or do you have in mind other kinds of damage that Perl could
cause which could be ameliorated through the use of other languages?

-- 
 Lloyd Zusman   ljz@asfast.com
 perl -le '$n=170;for($d=2;($d*$d)<=$n;$d+=(1+($d%2))){for($t=0;($n%$d)==0;
 $t++){$n=int($n/$d);}while($t-->0){push(@r,$d);}}if($n>1){push(@r,$n);}
 $x=0;map{$x+=(($_>0)?(1<<log($_-0.5)/log(2.0)+1):1)}@r;print"$x"'


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

Date: 12 Jan 1999 05:09:44 GMT
From: dformosa@zeta.org.au (David Formosa (aka ? the Platypus))
Subject: Re: Perl Criticism
Message-Id: <slrn79lm8o.mtj.dformosa@godzilla.zeta.org.au>

In article <77e7jg$mi5$1@nnrp1.dejanews.com>, topmind@technologist.com wrote:
>In article <slrn79gk7b.cjr.dformosa@godzilla.zeta.org.au>,
>  dformosa@zeta.org.au (David Formosa (aka ? the Platypus)) wrote:

[...]

>> It is very verbose isn't it?  This goes against yhour rapid
>> development rquirement.
>
>Very? It is about a 15% increase is characters. How does that
>qualify as "Very"?

Every little delay, every litte bit of verbosity slows me down and disrupts
my train of thourt.

[...]

>> Perl handels a veribal number of parameters, why can't your lang?
>
>I never said it could not. I am just resisting the urge
>to put every feature in it.

Why?  If you only include thouse features you think are neccery it
will only be good for people like you.

[...]

>(Array parameters seem to satisfy such needs about 90% of the time.
>Besides, I differientiated between what the interpreter can
>handle and what can be implemeted with the language itself.
>Thus, a built-in function may be able to handle variable qty of params,
>but not a programmer-built one.)

Why should this be?  I'm of the firm beleaf that what ever the
interprator can do the user should be able to as well.  

[...]

>I do not remember all the arguments that I *did* present, but
>one is confusion about what is a boolean expression
>and what is a leaky assignment. It is too easy to
>confuse and mistype "=" and "==".

Then have your boolean equility operator called "eq" then.


-- 
Please excuse my spelling as I suffer from agraphia. See
http://www.zeta.org.au/~dformosa/Spelling.html to find out more.
How to win arguments on usenet http://www.zeta.org.au/~dformosa/usenet.html



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

Date: 12 Jan 1999 05:40:52 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Perl Criticism
Message-Id: <slrn79lo34.fmt.sholden@pgrad.cs.usyd.edu.au>

On 12 Jan 1999 01:05:49 GMT, David Formosa (aka ? the Platypus)
	<dformosa@zeta.org.au> wrote:
>In article <77e4eg$jro$1@nnrp1.dejanews.com>, topmind@technologist.com wrote:
>>In article <slrn79ggu1.cjr.dformosa@godzilla.zeta.org.au>,
>>  dformosa@zeta.org.au (David Formosa (aka ? the Platypus)) wrote:
>>> In article <778gcs$ufi$1@nnrp1.dejanews.com>, topmind@technologist.com wrote:
>
>[...]
>
>>> >@_(-->$/(.)/up/Your*$s\\|>you&%!$@#crypt=++||#@tol<>>??logists!@#
>>>
>>> Thats not valid perl.
>>
>>But I bet it is only a few keystrokes away from being runnable.
>
>How much?

Well in vi it only takes two : d$

Damn I posted to this thread... I blaim abigail... that post caused the thread
to move up a bit (since I am one of the few that enjoys abigail's posts) so
I actually read a little of it...

I think I might make the 'I obviously have no life list' from the people who
have posted to this thread except during the initial 'I didn't realise it
was a religious nut' period. 

-- 
Sam

Even if you aren't in doubt, consider the mental welfare of the person
who has to maintain the code after you, and who will probably put parens
in the wrong place.	--Larry Wall


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

Date: 12 Jan 1999 05:54:04 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Perl Criticism
Message-Id: <slrn79lors.fmt.sholden@pgrad.cs.usyd.edu.au>

On Tue, 12 Jan 1999 00:37:10 GMT, topmind@technologist.com
	<topmind@technologist.com> wrote:
>In article <yllnjc82hs.fsf@windlord.stanford.edu>,
>  Russ Allbery <rra@stanford.edu> wrote:
>> topmind <topmind@technologist.com> writes:
>>
>> > I challenged someone to show me why Perl's power cannot be cleaned up
>> > without significant (initial) productivity loss.  I have not seen any
>> > yet.
>>
>> Perhaps because many of us believe that, like nearly all programming
>> languages, Perl is as "clean" as the programmer wishes it to be.  You can
>> write clean Perl and you can write obfuscated Perl, things like my sig.
>> My production code doesn't look anything at *all* like my signature, and
>> if someone tried to do something like that in a production script, I'd
>> have a long talk with them.
>>
>> The same is true of most languages.  The dichotomy you're presenting is
>> not one that many of us agree with, so your challenge doesn't mean
>> anything to us.
>
>From my webpage:
>
>"There is a saying in the Unix community that one should not prevent idiots
>from abusing something because it may prevent someone else from making good
>use of it. In other words, give everyone chain-saws because (hopefully) more
>people will build useful things than the number who will damage something or
>someone. However, it is my observation that more programmers are more likely
>to abuse a language than make good use of it. This is usually because the
>incentive to finish fast is greater (and easier to measure) than the
>incentive to make coherent and maintainable systems. Thus, I unfortunately
>have to disagree with the "Unix Chain-saw" rule."

You can have your opinions, nothing wrong with that. Not allowing bad
programmers to cause damage will also stop the good programmers from
doing that which hasn't been thought of yet. You think that's a price
worth paying, the Unix philosophy doesn't. So of course people who
follow a different philosophy aren't going to do your leg work
for you. 

>
>In short, I don't trust other programmers any more
>than I trust automechanics. There is no decent feedback
>loop to punish bad programmers who can deliver short-term
>results at the expense of maintanable code.

It's called a code-review... But you won't care so why am I bothering.

>
>Also, I still believe in the idea that 80% of Perl's power can
>be kept without the holes of abusability left in it.
>This is my main goal, not to bash Perl. Some of you are
>taking this personally.

Well take the latest source and produce a patch that does just that and
see if it works. This is how open source is meant to work. Freedom and all
that. 'Show me the code' is the cry when people just talk about the things
they think would be wonderful.

So write the code and if it works (and even if it doesn't probably) you'll
find others to help. You'll have to learn how not to resort to name calling
when you recieve criticism or it will all fall apart of course.

I actually look forward to seeing your new project to create a better perl.
I just doubt you actually want to do any more than talk about your ideas,
as evidenced by the details required for implementation missing from your
web pages.

-- 
Sam

Fifty years of programming language research, and we end up with C++ ???
                --Richard A. O'Keefe


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

Date: 12 Jan 1999 06:04:59 GMT
From: dformosa@zeta.org.au (David Formosa (aka ? the Platypus))
Subject: Re: Perl Criticism
Message-Id: <slrn79lpgb.mtj.dformosa@godzilla.zeta.org.au>

In article <77e7vo$mtk$1@nnrp1.dejanews.com>, topmind@technologist.com wrote:
>In article <m3lnjb7ckh.fsf@moiraine.dimensional.com>,
>  Daniel Grisinger <dgris@moiraine.dimensional.com> wrote:

[...]

>> In matters technical the only thing that matters, the only thing that
>> has ever mattered, and the only thing that will ever matter is a
>> working implementation. [...]

>That is utterly ridiculous! Why is a working implimentation so
>important?

Because in the end its the only true test of a systems worth.

> Nobody has questioned the implimentability of the features I describe.

No just the disirablity.

>It is like saying that only great performers can compose
>music.

No its like saying the only way to judge  music is to listen to it being played.

> Even cartooning is split between the concept
>people and the actual animators (usually done in Korea).

I think you mean animation.

>Who invented the implimentation criteria?

Cold hard realists, the peaple who also invented "Ruff connensus and
running code."

-- 
Please excuse my spelling as I suffer from agraphia. See
http://www.zeta.org.au/~dformosa/Spelling.html to find out more.
How to win arguments on usenet http://www.zeta.org.au/~dformosa/usenet.html



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

Date: 12 Jan 1999 06:05:48 GMT
From: dformosa@zeta.org.au (David Formosa (aka ? the Platypus))
Subject: Re: Perl Criticism
Message-Id: <slrn79lphr.mtj.dformosa@godzilla.zeta.org.au>

In article <77e84l$n10$1@nnrp1.dejanews.com>, topmind@technologist.com wrote:
>
>
>> The "=" is an operator.  As "a = b' is an
>> expression, it has a value.  If you use that expression as the RHS of another
>> assignment, the value gets assigned.  It is NOT leakage.
>>
>
>You call it what you want, and I will call it what I want.

Yes humpty dumpty.

-- 
Please excuse my spelling as I suffer from agraphia. See
http://www.zeta.org.au/~dformosa/Spelling.html to find out more.
How to win arguments on usenet http://www.zeta.org.au/~dformosa/usenet.html



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

Date: 12 Jan 1999 06:09:39 GMT
From: dformosa@zeta.org.au (David Formosa (aka ? the Platypus))
Subject: Re: Perl Criticism
Message-Id: <slrn79lpp3.mtj.dformosa@godzilla.zeta.org.au>

In article <369dc29d.91959290@nntp.ix.netcom.com>, Michael Rubenstein wrote:

[...]

>Only two key strokes are needed to make it runnable:
>
>'@_(-->$/(.)/up/Your*$s\\|>you&%!$@#crypt=++||#@tol<>>??logists!@#'

Only one is realy needed.

#@_(-->$/(.)/up/Your*$s\\|>you&%!$@#crypt=++||#@tol<>>??logists!@#

-- 
Please excuse my spelling as I suffer from agraphia. See
http://www.zeta.org.au/~dformosa/Spelling.html to find out more.
How to win arguments on usenet http://www.zeta.org.au/~dformosa/usenet.html



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

Date: 12 Jan 1999 06:33:31 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Perl Criticism
Message-Id: <slrn79lr5r.fmt.sholden@pgrad.cs.usyd.edu.au>

On Tue, 12 Jan 1999 01:19:55 GMT, topmind@technologist.com
	<topmind@technologist.com> wrote:
>In article <m3lnjb7ckh.fsf@moiraine.dimensional.com>,
>  Daniel Grisinger <dgris@moiraine.dimensional.com> wrote:
>> trollboy <topmind@technologist.com> spewed forth across our group:
>>
>> > In article <3696A757.E2AE40D4@mediaone.net>,
>> >   "Michael D. Schleif" <mds-resource@mediaone.net> wrote:
>>
>> > > Seriously, please, present your alternative language so that we may be
>> > > amazed or continue our amusement }:-^
>> > >
>>
>> > Is my 85k webpage not enough detail on my suggestions?
>>
>> No, it's not.
>>
>> In matters technical the only thing that matters, the only thing that
>> has ever mattered, and the only thing that will ever matter is a
>> working implementation.  Since you have such a deep grasp of the finer
>> points of language design and construction implementing your language
>> should be none too difficult.
>>
>
>That is utterly ridiculous! Why is a working implimentation so
>important? Nobody has questioned the implimentability of
>the features I describe.

Because until it is implemented you can't actually test things out. If 
you design the whole language based on purely theoretic concerns then
you will end up with yet another language that is unusable in the real
world. 

This is why researchers spend time and money building things so they can
test there ideas out. Since you seem to think that the programmer's
preferences should be given some weight (I could be wrong I've only
skimmed your we page), how do you know which preferences are more 
important to include (since you can't have everything as the language would
be to big to use). You seem to assume based on your observations of programmers
(I assume anyway) that statement seperators, block seperators, etc are what
programmers want.

However, until you build something and test this you don't really know. Those
are what you observe now because those are the things that are most obviously
different about languages. The most important preference could be something
you haven't thought of yet, which might be revealed by building something and
getting people to play with it.

I for one would like to be able to use spaces in my variable names instead
of those cursed underscores (or maybe not)... Some of my fellow programmers
seem to want case insensitivity... others exploit case sensitivity to the
extreme.

>
>It is like saying that only great performers can compose
>music. Even cartooning is split between the concept
>people and the actual animators (usually done in Korea).

This is why we have these things called teams... Someone can design, someone
can implement, until you implement you have no guidance for your design.

Prototypes are the bread and butter of research.

>
>Who invented the implimentation criteria? And where
>is their web page discussing why that criteria
>is the most important?

They are long dead long before the web. Long before computers. 

Do you think something like the bicycle was designed without a little
bit of building just to see what is more comfortable, more efficient, etc.
And roadways were designed before they built a small test road to check they
were wide enough...

-- 
Sam

comments on data are usually much more helpful than on algorithms
	--Rob Pike


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

Date: 12 Jan 1999 05:01:18 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: regexp across multiple arrays, that aren't alike...
Message-Id: <77ekuu$eee$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Jim Matzdorff
<syran@best.com>],
who wrote in article <77ehlu$ia1$1@shell18.ba.best.com>:
> foreach (@array1)
> {
> 	push (@new, (grep /$_/, @array2));
> }

In spring/summer I sent a patch which would speed up this enormously.
Sarathy did not accept it (motivating with some obscure reasons - but
he is not obliged at all to motivate his decision).

Lobby, and you will receive.  1/2 ;-)

Currently you need to make some obscure modifications to your code,
say, 

     @array1 = map qr/$_/, @array1;

(my patch would do essentially the same, but transparently).

Ilya


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

Date: Tue, 12 Jan 1999 05:25:51 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: regexp across multiple arrays, that aren't alike...
Message-Id: <ebohlmanF5FLr4.Jqw@netcom.com>

Jim Matzdorff <syran@best.com> wrote:

: array1: jack,jill,mike,millie,jeff,gordon
: array2: jack is nice, mike is cool, my dog's name is millie, gordon races

: The result I want to get would be an array wtih the 1st, 2nd, 4th, and
: 6th values of array2.

: Now I *WAS* using:

: foreach (@array1)
: {
: 	push (@new, (grep /$_/, @array2));
: }

: which worked just fine.  UNTIL i got up to the 500-1000 array values.
: things slowed WAYYYYYYYYY down not to mention has the possiblity of
: running out of memory (which is understandable).  the question
: is, how do i go about speeding things up again.  i am a little bit lost.

You're slowing down because the number of comparisons you need to make is 
proportional to the product of the sizes of your two arrays, and that 
product gets big rather quickly.  Fortunately, with the help of hashes, 
you can reduce the number of comparisons to the sum of the two array 
sizes, which is a much more manageable number than their product.  The 
techniques in the arrays section of perlfaq4 are likely to be helpful here.

You've left a rather important detail unspecified: what happens if one of 
the words in your first array appears in more than one entry in the 
second?  How you resolve this will be important to your solution.  In 
either case, you're going to need to set up a hash whose keys are all the 
words appearing in any of the strings in your second array.  If you need 
to get only the first (or last) match from the second array, the values 
of the hash can simply be the indices of the first (or last) element of 
the second array in which the word was found.  If you need all the 
matches, you're going to have to use a hash of arrays where the values 
are references to lists of element positions in the second array.

You will also need to define what constitutes a "word."

: and while i have your attention, is there somewhere i can find out a
: little bit more about using grep, map, splice, push and etc. for array
: manipulation?  I can't find much on perl.com and it still confuses the heck
: out of me.

Check out the perlop and perldata (man pages | HTML document | POD files) 
that came with your perl distribution.  Once you understand them 
thoroughly, check out perlref, perllol and perldsc.


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

Date: Fri, 8 Jan 1999 18:43:53 +0800
From: "wtsai" <wtsai@ms.chttl.com.tw>
Subject: Socket in Perl - help??????
Message-Id: <774ncf$afc@beast-2.news.chttl.com.tw>

I am writing client/server program by Perl. The client sends data to
the server and receives the response from the server on the same
Socket connection. The question is: once the client sends binary
data through the socket connection, then it won't receive any respose
from the server. For the character string, the program works fine!
Can anyone help me out? Thanks in advance!

Star





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

Date: 12 Jan 1999 06:40:47 GMT
From: meowing@banet.net (Fluffy)
Subject: Re: Socket in Perl - help??????
Message-Id: <77eqp7$ddj@meow.invalid>

wtsai <wtsai@ms.chttl.com.tw> wrote:
> I am writing client/server program by Perl. The client sends data to
> the server and receives the response from the server on the same
> Socket connection. The question is: once the client sends binary
> data through the socket connection, then it won't receive any respose
> from the server. For the character string, the program works fine!

You are probably blocking.  Can you post some sample code to
demonstrate the problem?
-- 
"Meow."  --me


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

Date: Tue, 12 Jan 1999 00:01:37 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: URGENT: Array of arrays...
Message-Id: <1goe77.evc.ln@magna.metronet.com>

The Corruptor (corruptor@terry.org.uk) wrote:

: I'm trying to create an array of arrays, and can't figure out the
: syntax to do so.


   Why not just do it the way described in the documentation for
   creating an array of arrays?

   That would be the 'perllol.pod' file, titled:

      perlLoL - Manipulating Lists of Lists in Perl


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Mon, 11 Jan 1999 22:50:50 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: What is $1 ???
Message-Id: <abke77.llc.ln@magna.metronet.com>

I R A Aggie (fl_aggie@thepentagon.com) wrote:


: If there is no match, I would expect $1 to be 'undef'.


   ...or the value that it had from any previous _successful_ match:


--------------------------
#!/usr/bin/perl -w

$_ = 'foobar';
/(foo)/;          # successful match

$things[0] = 'ID=1234';
if ($things[0] =~/id=([0-9]+)/)
   { print "matched '$1'\n" }
else
   { print "NO match '$1'\n" }
--------------------------

prints:

NO match 'foo'


   $1 is unaffected by UNsuccessful matches.

   If it was undef before the unsuccessful match, it will be
   undef after.

   If it was something else before, it will be something else after.



--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 12 Jan 1999 00:09:31 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Year 2038 problem
Message-Id: <77e3rr$5b9$3@client3.news.psi.net>

Trond Michelsen (mike@crusaders.no) wrote on MCMLIX September MCMXCIII in
<URL:news:77ddn7$krn$1@romeo.dax.net>:
$$ 
$$ 
$$ If I'm not mistaking (I just might) this number is represented as an
$$ 32-bit integer only if you're using a 32-bit computer.

You are mistaken. I've a 64-bit computer, with a 64-bit OS, but a 
32-bit time.  Going from 32-bit time to 64-bit time is as difficult
as going from a 2-digit year to a 4-digit one: synchronization and
fized fields. What makes it worse is that every low level routine
uses 32-bit timestamps in one way or the other.



Abigail


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

Date: 12 Jan 1999 00:11:12 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Year 2038 problem
Message-Id: <77e3v0$5b9$4@client3.news.psi.net>

Bart Lateur (bart.lateur@skynet.be) wrote on MCMLIX September MCMXCIII in
<URL:news:369b3af1.1070543@news.skynet.be>:
() 
() Yes, there'll have to be a solution before then. It will most probably
() involve representing time in 64 bits.


30 years wasn't enough going from 2 digit years to 4 digit years.
What makes you think 40 years will be enough to go from 32 bits to 64?



Abigail


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

Date: Tue, 12 Jan 1999 00:35:30 -0500
From: "K.T." <death@N-O-S-P-A-M.solaris1.mysolution.com>
Subject: Re: Yet another REGEX question
Message-Id: <77emmv$l7r$1@nnrp02.primenet.com>

Cool, that works...I don't understand some of the expressions used fully
tho.
[] is used for sets [^] means no range...what does [^\t] do?
also what is the [+-]?  I think that is in case of a sign present? And why
is that suffixed with the "*" and not "*?"?

BTW thanks.
-Kane

John Moreno wrote in message
<1dlh7nm.cmkhucz55x8cN@roxboro0-051.dyn.interpath.net>...
>
>$_="string1\tstring2\t-305\tstring4";
>
>s/([^\t]*?)\t([^\t]*?)\t([+-]*\d*?)\t(.*)/"$1","$2",$3,"$4"/;
>
>gives:
>"string1","string2","-305","string4"
>
>
>The newline didn't need to be touched and if you have more than one line
>you'll have to add the /g -- other than that this should do just what
>you want (note that you'll end up with ,, for the number if it's
>absent).
>
>--
>John Moreno




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

Date: 12 Jan 1999 00:24:11 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Yet another REGEX question
Message-Id: <77e4nb$5b9$6@client3.news.psi.net>

K.T. (death@N-O-S-P-A-M.solaris1.mysolution.com) wrote on MCMLIX
September MCMXCIII in <URL:news:77dnv0$ams$1@nnrp03.primenet.com>:
() Anyone know how to do this?
() string1<TAB>string2<TAB>number3<TAB>string4<NEWLINE>
() any of the strings or numbers can be not present so it might be <TAB><TAB>
() convert to
() "string1","string2",number3,"string4"<NEWLINE>

{   
    local $^W = 0;
    my @a = qw /" "," ", ," "/;
}
while (<>) {
    my $i = 0;
    s/^|\t|$/$a[$i++]/ge;
}



Abigail


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

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


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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