[8835] in Perl-Users-Digest
Perl-Users Digest, Issue: 2452 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Apr 29 07:07:19 1998
Date: Wed, 29 Apr 98 04:00:27 -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 Wed, 29 Apr 1998 Volume: 8 Number: 2452
Today's topics:
Re: 1701 days hath September (was: Re: rename funciton) <qdtcall@esb.ericsson.se>
Re: ANNOUNCE: Perl Builder IDE Now Available <neeri@iis.ee.ethz.ch>
Re: CGI-Mail Problem (-)
Re: Cookies (Craig Berry)
Re: Defending Perl <qdtcall@esb.ericsson.se>
file comparison <gland@ccs.neu.edu>
Re: file comparison <rootbeer@teleport.com>
Re: GCC and Solaris can't handle dynamic load ? (Georg Rehm)
Re: help: HTTP GET method with Perl for NT/95 <Tony.Curtis+usenet@vcpc.univie.ac.at>
Re: How many days between two dates problem <sowmaster@juicepigs.com>
Re: How to read command line literally? <zenin@archive.rhps.org>
Re: image size for jpg and/or gif <admin@hatsoft.com>
Re: Initializing hash with null array: which is best? <webmaster@fccjmail.fccj.org>
Re: Initializing hash with null array: which is best? <merlyn@stonehenge.com>
Re: message board question <idk@idkconsulting.com>
Passing data to 'sub' functions? <jaws@guardianangels.se>
Re: Passing data to 'sub' functions? <wd@uebemc.siemens.de>
Re: Passing data to 'sub' functions? <rootbeer@teleport.com>
Re: Permutations in hashes make Perl hurt (Gurusamy Sarathy)
Re: Permutations in hashes make Perl hurt <jhi@alpha.hut.fi>
Re: Permutations in hashes make Perl hurt (Frank)
Problemsinstalling Perl on Red Hat 5.0 (Harry Zink)
Re: Reg Exp problem troxel@sammcgees.com
Re: Splitting a variable ??? <lr@hpl.hp.com>
Re: Sys::syslog not working? <qdtcall@esb.ericsson.se>
Re: techniques for tagging substitution areas in templa <sam@peritas.com>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 29 Apr 1998 12:14:52 +0200
From: Calle Dybedahl <qdtcall@esb.ericsson.se>
Subject: Re: 1701 days hath September (was: Re: rename funciton)
Message-Id: <ispvi1rl2b.fsf@godzilla.kiere.ericsson.se>
Lloyd Zusman <ljz@asfast.com> writes:
> But now that we've been enlightened, I'm disappointed to find that
> it's just more gratuitous anti-"newbie" snobbery.
"Gratuitous"? If you'd been there you'd know the difference, boy.
Abigail is absolutely right.
--
Calle Dybedahl, UNIX Sysadmin
qdtcall@esavionics.se http://www.lysator.liu.se/~calle/
------------------------------
Date: 29 Apr 1998 10:24:26 +0200
From: Matthias Neeracher <neeri@iis.ee.ethz.ch>
Subject: Re: ANNOUNCE: Perl Builder IDE Now Available
Message-Id: <86ogxl11dx.fsf@gwaihir.ethz.ch>
"Grinch" <grinch@whoville.com> writes:
> Tool tips, btw, are the little text messages that, in many apps, appear when
> you "hover" the mouse pointer for a second or two. Apple, as usual, insists
> on being different and calls them "Balloon Help." In this case, they display
> the value of the variable over which the pointer is hovering.
a) In this case, "Balloon Help" is obviously a better description, wouldn't
you agree ? Variables are not "tools" and their value is not a "tip".
b) However one might call it, this is a neat idea. I'll have to implement
that in MacPerl one of these days.
Matthias
--
Matthias Neeracher <neeri@iis.ee.ethz.ch> http://www.iis.ee.ethz.ch/~neeri
"Besides, we Satanists have enough PR problems without having to also
distance ourselves from Scientology."
-- Hilary Osborne in <6hmdpq$bf5$1@isn.dac.neu.edu>
------------------------------
Date: Wed, 29 Apr 1998 08:24:42 GMT
From: root.noharvest.\@not_even\here.com (-)
Subject: Re: CGI-Mail Problem
Message-Id: <3546e2e4.51295053@nntp.idsonline.com>
GRau@alcatel.de (Gaby Rau) Said this:
>Hi all,
>
>I have a problem with sending an external Email from an Perl-CGI-Script.
>
>I put a perl-Script in my cgi-bin-Directory (Server Apache 1.0.5),
>which handles a HTML-Form an finally sends a message:
>
> open ( MAIL , "| mail $adr");
> print MAIL "$message";
> close(MAIL);
>
>The problem is $adr! If it is in the form localuser@localmachine, it works.
>If I try to send it to any other Email adress (e.g. my own see below),
>it does not! The mail is then sent to "root" (Postmaster) with an error
>message like this
>
> Connected to mailhost:
> >>> MAIL From:<nobody@slszwg.stgl.sel.alcatel.de>
> <<< 550 Unknown local user 'nobody'
> 554 GRau@alcatel.de... Remote protocol error
>
>So I guess, I have to provide somehow my identity to the CGI-Script?
>But how? Any idea?
>
use the following as an example. As long as you don't include an
account name in the open command, it will take whatever you want in
the From: line without question. If you include a username in the
open command and that name doesn't exist, it will pick up whatever
valid name the script was invoked with (if it's a cgi script, it'll be
nobody, www, or whatever the httpd server runs as).
open (MAIL, "|/usr/sbin/sendmail -t");
print MAIL "Reply-To: somebody\@somewhere.com (Somebody) \n";
print MAIL "Organization: Mostly Disorganized \n";
print MAIL "From: somebody\@somewhere.com (Somebody) \n";
print MAIL "To: me@mydomain.com (To ME!!) \n";
print MAIL "Subject: Oh, this is a message\n";
print MAIL "\n";
print MAIL <<"END_OF_MESSAGE";
blah blah blah, yadda yadda yadda
Thank you,
ME
END_OF_MESSAGE
close MAIL;
Don't know about mail, but sendmail works pretty darn well, and that
way it's a question relative to comp.mail.sendmail
(and why do so many new internet users insist on posting their
messages to EVERY Usenet newsgroup they can think of? Isn't just one
enough? Do you call every customer service phone number you can think
of when you need phone support? Or just one?)
------------------------------
Date: 29 Apr 1998 06:57:27 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Cookies
Message-Id: <6i6j0n$p0t$1@marina.cinenet.net>
brian d foy (comdog@computerdog.com) wrote:
: In article <3544B942.6FC1@ameritech.net>, svetter@ameritech.net posted:
: >In the cookies parameter you can specify an expiration date. In the
: >doc I have it is hard coded. Is there a way to set this date to the
: >current date, plus one year? I would perfer seeing the code as opposed
: >to using a subroutine.
:
: you can see the code and use the subroutine. look at the nifty Date::*
: modules on CPAN. read the docs *and* look inside the module :)
Or ditto on CGI.pm, which is part of the 5.004+ standard distribution.
See the cookie() function, which both sets and reads cookies, and the
header() function, into which cookies generated by cookie() get passed.
One of the parameters to cookie() is an expiration time, which accepts
human-readable relative times like '+1y'.
I do all my cookie-related stuff through CGI.pm, and *highly* recommend
it.
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: 29 Apr 1998 09:52:27 +0200
From: Calle Dybedahl <qdtcall@esb.ericsson.se>
Subject: Re: Defending Perl
Message-Id: <is67jtt684.fsf@godzilla.kiere.ericsson.se>
abigail@fnx.com (Abigail) writes:
> Now try to figure out which variables to change if you don't want to
> install in /usr/local. It's not impossible, but the first time you
> try, you might miss a few things you need to change.)
The first time you try, you read the INSTALL file and see how to do
that without messing about with changing variables in scripts. It's
even got a clear example of how to install in /opt/perl instead of
/usr/local without running Configure interactively.
If you don't read the documentation, it might be harder, I guess.
Personally, I have always found Perl easier to install than gcc, even
on fairly odd platforms.
--
Calle Dybedahl, UNIX Sysadmin
qdtcall@esavionics.se http://www.lysator.liu.se/~calle/
------------------------------
Date: 29 Apr 1998 06:06:39 GMT
From: Greg Land <gland@ccs.neu.edu>
Subject: file comparison
Message-Id: <6i6g1f$9u1$1@camelot.ccs.neu.edu>
Since I know that there are ppl here that really *KNOW* perl, here goes:
I have one file looking like this:
MOVE_IXLEFT GRP_PK 102400 20480
MOVE_IXLEFT ER_MESS_TEMP_IDX 20480 20480
TABLESPACE_N SEGMENT_NAME INITIAL_EXTENT NEXT_EXTENT
------------ -------------------- -------------- -----------
MOVE_IXLEFT ER_MESS_IDX 20480 20480
MOVE_IXLEFT DOWNLD_ERR_LOG_PK 5120000 5120000
And another file that looks like this:
TABLESPACE_NAME TOTAL******BYTES
------------------------------ ----------------
"MOVE_IXLEFT 152,203,264 "
"MOVE_IXMIX1 5,525,504 "
"MOVE_IXMIX1 298,881,024 "
now for the question: I need to compare the number values between the
"NEXT_EXTENT" and the "TOTAL BYTES" and see which is larger, but only
when the "TABLESPACE_N" is the same as "TABLESPACE_NAME".
Thanx in advance
Question
PS. Any help would be greatly appreciated :)
------------------------------
Date: Wed, 29 Apr 1998 06:30:12 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Greg Land <gland@ccs.neu.edu>
Subject: Re: file comparison
Message-Id: <Pine.GSO.3.96.980428232822.3378W-100000@user2.teleport.com>
On 29 Apr 1998, Greg Land wrote:
> I need to compare the number values between the
> "NEXT_EXTENT" and the "TOTAL BYTES" and see which is larger, but only
> when the "TABLESPACE_N" is the same as "TABLESPACE_NAME".
Well, you'll probably want an if statement. If that's not where you're
stuck, can you show us how far you've gotten? Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 29 Apr 1998 10:37:09 GMT
From: georg@cl-ki.uni-osnabrueck.de (Georg Rehm)
Subject: Re: GCC and Solaris can't handle dynamic load ?
Message-Id: <6i6vsl$pgc$1@newsserver.rrzn.uni-hannover.de>
Greg Bacon (gbacon@cs.uah.edu) wrote in <6hib14$qui$2@info.uah.edu>:
> Are you using GNU as and GNU ld? gas + gld + gcc + perl + Solaris is
> a fatal combination. The INSTALL document that ships with the perl
> distribution specifically addresses Solaris and dynamic loading.
True, but it says that you can either call "Configure" with
-Dcc='gcc -B/usr/ccs/bin/' or add "-B/usr/ccs/bin/" during
the interactive configuration procedure to overcome this So-
laris problem. As far as I remember, you have to do _both_
things.
Greetings,
Georg
--
Georg Rehm georg@cl-ki.uni-osnabrueck.de
Institute for Semantic Information-Processing, University of Osnabrueck, FRG
------------------------------
Date: 29 Apr 1998 11:59:25 +0200
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: help: HTTP GET method with Perl for NT/95
Message-Id: <7xn2d5aqyp.fsf@beavis.vcpc.univie.ac.at>
Re: help: HTTP GET method with Perl for NT/95, Alex
<lidong@globalserve.net> said:
Alex> Dear Perl experts, especially experts on perl for win
Alex> NT/95, Is there a simple GET method subroutine in
Alex> perl, which works on WinNT/95?
LWP
tony
------------------------------
Date: Wed, 29 Apr 1998 02:09:14 -0400
From: Bob Trieger <sowmaster@juicepigs.com>
To: Alex <alexp@mira.net>
Subject: Re: How many days between two dates problem
Message-Id: <3546C40A.3B@juicepigs.com>
Alex wrote:
>
> Hi,
> Is there a way anyone knows of to get Perl 5 to determine how many days
> are bewteen two dates? I'm trying to build a web site which displays
> how long a project has been running, but the only data supplied are
> dates.
The Date::Manip and Date::DateCalc modules will do that for you.
--
Bob Trieger | Titanic: big boat, bigger
sowmaster@juicepigs.com | iceberg, big deal
------------------------------
Date: 29 Apr 1998 06:49:06 GMT
From: Zenin <zenin@archive.rhps.org>
Subject: Re: How to read command line literally?
Message-Id: <893832976.399987@thrush.omix.com>
Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:
>snip<
: In some respect DOSish shells are braindead indeed. But not in this
: one: the fact that DOSish shells do not mangle the command line is the
: great advantage - comparing the braindead *nixish behaviour.
Sorry Ilya, but you're smoking crack, you must be...
: If a program wants globbing of the command line, it may just do
: main(int argc, char *argv[], char *env[])
: {
: glob_wildcards(&argc,&argv);
: ...
: }
To what end? We've just beaten this to death in the FreeBSD
groups. Even the original supporters of the idea have changed
there minds and come back to reality. Unless you plan to remove
any and all redirection functionality as well, there is NO legit
reason to pass a non-expanded command line to a program by default.
None.
: But if it wants, it may examine the command line and find what user
: wanted, so there is no braindead backslashitis and quotitis for
: something like
:
: find . -name *.blah
: or
: unzip foo *.c
You're talking about *major* exceptions to what most programs
need from the command line. Why in the world would you create the
mass hell that would be 100's of different globing styles per
application (eg DOS and CP/M commands) and throw out all
redirection features for the sake of not having to type two quotes
around the arguments to an *extremely* small number of programs???
The *only* reason DOS, CP/M, VAX, et al can get away with it
is because they lack the extremely useful power of Unix shell
redirection features. Even then, it's caused far more problems
then it has *ever* helped.
: Command line is the most important element of IPC,
The "most important element of IPC"??? Since when? It might be
considered the most important part of *user* to program
interaction, but not interprocess communication.
: and the fact that
: it is unreachable is one of the few stupidities of the *nixish paradigm.
Sorry, but this isn't even a matter of opinion. You're just wrong.
--
-Zenin
zenin@archive.rhps.org
------------------------------
Date: Tue, 28 Apr 1998 23:01:38 -0700
From: "Henry Wolff" <admin@hatsoft.com>
Subject: Re: image size for jpg and/or gif
Message-Id: <3546c1ef.0@news.greatbasin.net>
The second post was the results of trying it in my own directory.
It was my impression that the PREFIX=/libs according to the perlfaq8 did
that. I also tried PREFIX=/res/home/hatsoft/WWW/libs and the same error (You
do not have permissions to install into
/usr/libdata/perl5/site_perl/i386-bs) came up on the make install. What
permission level does the /libs directory have to have? I have it set for
rwxrwxrwx or 777.
Thanks,
Henry Wolff
Send Some Virtual Postcards - FREE
http://www.hatsoft.com/webcard/index.html
------------------------------
Date: Wed, 29 Apr 1998 10:13:53 GMT
From: Bill 'Sneex' Jones <webmaster@fccjmail.fccj.org>
Subject: Re: Initializing hash with null array: which is best?
Message-Id: <3546FBB0.2A3B28FE@fccjmail.fccj.org>
Ronald J Kimball wrote:
>
> Zenin wrote:
> >
> > > Not really. It just _looks_ like a list. There's no such thing as a list
> > > in a scalar context in Perl.
> >
> > Err...huh?
> >
> > @foo = qw(foo bar cat dog);
> > $bar = @foo; # list evaluated in scalar context
> > print $bar; # prints 4
> > $bar = scalar @foo; # explicitly asking for list in scalar context
> > print $bar; # still prints 4
>
> <sarcasm>
> Oh goody! Can we have this discussion *again*, pleeeeeeeeeeeeeeeeeeeeez??!
> </sarcasm>
>
> That's not a list, that's an array.
>
> Now go use dejanews to find the last umpteen times this issue was debated.
>
> --
> _ / ' _ / - aka - rjk@coos.dartmouth.edu
> ( /)//)//)(//)/( Ronald J. Kimball chipmunk@m-net.arbornet.org
> / http://www.ziplink.net/~rjk/
> "It's funny 'cause it's true ... and vice versa."
I love you guys!
I REALLY feel your pain.
-Sneex- :-)
____________________________________________________________________________
Bill Jones | FCCJ Webmaster | Voice 1-904-632-3089 | Fax 1-904-632-3007
Florida Community College at Jacksonville | 501 W. State St. | Jax, FL 32202
mailto:webmaster@fccjmail.fccj.org | http://webmaster.fccj.org/Webmaster
------------------------------
Date: Wed, 29 Apr 1998 10:54:17 GMT
From: Randal Schwartz <merlyn@stonehenge.com>
To: abigail@fnx.com
Subject: Re: Initializing hash with null array: which is best?
Message-Id: <8cpvi0oq4t.fsf@gadget.cscaper.com>
>>>>> "Abigail" == Abigail <abigail@fnx.com> writes:
Abigail> Remember kids: There is no general rule of converting lists to scalars.
Although more accurately, this is:
There is no rule of converting lists to scalars. It can't be done.
A list will never exist in a scalar context, even for a moment.
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 125 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Wed, 29 Apr 1998 08:07:38 +0100
From: Matthew Wheeler <idk@idkconsulting.com>
Subject: Re: message board question
Message-Id: <3546D1BA.5ECABC3C@idkconsulting.com>
I didn't want to waste time reading about newsgroups when I knew I'd only be
here a day or two. I believe I did it right though, so I can't be that bad.
As for your response, I've already read those guides. They didn't help.
Thanks though.
> Then you should read news.announce.newusers before posting. It's not your
> fault that you didn't know this; your ISP should have instructed you.
>
> The docs for that script should help you out; if not, perhaps you should
> complain to the author.
>
> When you're having trouble with a CGI program in Perl, you should first
> look at the please-don't-be-offended-by-the-name Idiot's Guide to solving
> such problems. It's available on CPAN.
>
> http://www.perl.com/CPAN/
> http://www.perl.org/CPAN/
> http://www.perl.org/CPAN/doc/FAQs/cgi/idiots-guide.html
> http://www.perl.org/CPAN/doc/manual/html/pod/
>
> Hope this helps!
>
> --
> Tom Phoenix Perl Training and Hacking Esperanto
> Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 29 Apr 1998 10:41:53 +0200
From: "Patrik Lvwendahl" <jaws@guardianangels.se>
Subject: Passing data to 'sub' functions?
Message-Id: <3546e829.0@d2o64.telia.com>
How do I pass certain data to a sub function?
I've tried to do it the 'C' way :
sub func($string) {
print $string; }
when i call it:
&func('Hello');
I can't get this to work.. Please help !!
// Patrik
------------------------------
Date: 29 Apr 1998 09:20:38 GMT
From: Wolfgang Denk <wd@uebemc.siemens.de>
Subject: Re: Passing data to 'sub' functions?
Message-Id: <6i6rd6$fa$1@galaxy.mchh.siemens.de>
"Patrik Lvwendahl" <jaws@guardianangels.se> writes:
>How do I pass certain data to a sub function?
As described in the docs, I think.
>I've tried to do it the 'C' way :
...
>I can't get this to work.. Please help !!
To get you started: read the perlsub man page.
Wolfgang Denk
Office: (+49)-89-722-27328, Fax -36703 Wolfgang.Denk@oen.siemens.de
Private: (+49)-89-95720-110, Fax -112 wd@denx.muc.de
Always leave room to add an explanation if it doesn't work out.
------------------------------
Date: Wed, 29 Apr 1998 10:37:32 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Patrik Lvwendahl <jaws@guardianangels.se>
Subject: Re: Passing data to 'sub' functions?
Message-Id: <Pine.GSO.3.96.980429033636.3378X-100000@user2.teleport.com>
On Wed, 29 Apr 1998, Patrik L=F6wendahl wrote:
> How do I pass certain data to a sub function?
The perlsub manpage has some suggestions.
> I've tried to do it the 'C' way :
>=20
> sub func($string) {
> print $string; }
Maybe you should try the Perl way, now. :-)
Hope this helps!
--=20
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: 29 Apr 1998 07:13:56 GMT
From: gsar@engin.umich.edu (Gurusamy Sarathy)
Subject: Re: Permutations in hashes make Perl hurt
Message-Id: <6i6jvk$c48@srvr1.engin.umich.edu>
Keywords: marrow mien procreate shaw
[ mailed and posted ]
In article <6i6ei7$97o$1@mathserv.mps.ohio-state.edu>,
Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:
>P.S. I had actually *seen* (maybe even written ;-) code that uses
>permutations as hash keys. Gurusamy, how did this code with repeated
>strings came to your attention?
I hit upon it while doing some research to answer the following post (look
in dejanews for full version):
Subject: Re: Ques: Use of "[ ]" in map
From: eric.arnold@sun.com (Eric Arnold)
Date: 1996/12/04
Message-ID: <ERIC.96Dec04180810@m-e-ir1.sun.com>
Newsgroups: comp.lang.perl.misc
He was basically generating keys to benchmark hash vs. map &co.
with this code (excerpt from post above):
use Benchmark;
print "array len=" , $len = 10000 , "\n";
for ( $i = $len ; $i >= 0 ; $i--)
{
push( @array, "xx$i $i");
}
timethese(1, {
"map" => q{
@results = map { $_->[0] }
sort { $a->[1] <=> $b->[1] }
map { [$_, (split)[-1]] } @array;
},
"hash" => q{
for ( @array )
{
$h{$_} = (split)[-1];
}
@results = sort { $h{$a} <=> $h{$b} } @array;
}
});
And got this suspicious result:
array len=10000
Benchmark: timing 1 iterations of hash, map...
hash: 36 secs (35.25 usr 0.06 sys = 35.31 cpu)
map: 2 secs ( 1.52 usr 0.09 sys = 1.61 cpu)
Note how the keys are of the form "xx$i $i", and the repetition there
triggers pathologia. The space in the string doesn't matter because
it happens to be 2^5. Ouch. :-)
I happened to be busy at the time, so didn't actually get around to
articulating my findings then and eventually forgot to follow it up
later.
>Gurusamy's example convinced me that the current algorithm for hash
>keyspace growth cannot be fixed by changing hashing algorithm. One
>needs both: change 33 to something more meaningful, and change growth
>algorithm.
Indeed.
- Sarathy.
gsar@umich.edu
------------------------------
Date: 29 Apr 1998 10:45:57 +0300
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
To: ilya@math.ohio-state.edu
Subject: Re: Permutations in hashes make Perl hurt
Message-Id: <oeesomxkr4a.fsf@alpha.hut.fi>
ilya@math.ohio-state.edu (Ilya Zakharevich) writes:
> This is one of the faces of the fact that the number 33 which appears
> in the hash algorithm is *the worst possible number* I know (if you
> forget about 1 ;-). Putting 37 there would make it infinitely better
> for this case, for hashing integers, and probably in many other cases.
I do not think anybody is stopping you from changing the 33 into 37
and then heavily benchmarking which one is better. Remember the
balance between average speed and speed in pathological cases.
Off the cuff, I would imagine no single number is going to
be optimal for all the cases or free from pathological cases.
Of course, 1 is pretty close to being panpathological :-)
--
$jhi++; # http://www.iki.fi/~jhi/
# There is this special biologist word we use for 'stable'.
# It is 'dead'. -- Jack Cohen
------------------------------
Date: 29 Apr 1998 09:42:24 +0200
From: dont_use_this_ey@hotmail.com (Frank)
Subject: Re: Permutations in hashes make Perl hurt
Message-Id: <yo97m49ul9b.fsf@nym.sc.philips.com>
mjd@op.net (Mark-Jason Dominus) writes:
> >I would thing that contemporary processor multiply in one instruction,
> >do not they?
>
> This is really outside my area of expertise. But not all instructions
> take the same time, and I think that the multiplication instruction is
> usually much slower than add and shift instructions.
>
However it is wrong to extrapolate the behavior of gcc on a sun4 to
decide which algorithm to use. I really hope gcc behaves different on
other hardware plattforms.
Some processors support fast integer multiply. Most processors in
Mac/DOS/linux(pentium,powerpc) systems allow floating multiplication
in at most 3 clock cycles. This reduces to 1 clock cycle, if your
compiler manages to keep the pipeline filled. (I would doubt that for
gcc on pentium processors).
> Only stupid people would optimize multiplication to shift-and-add if
> there was not something to be gained from that. gcc was not designed
> by stupid people. Even in *un*optimized mode it generates
> shift-and-add instead of multiplication on sparc sun4, for example.
Another reason might be, that hardware advances much faster than the
software parts.
I looked at the UltraSparc processor datatsheet. I have no idea if
this is the processor used in your system, but it seems the smallest
one availiable there.
The datasheet states that an ultrasparc has a multi-cycle integer
unit, that means more than one clock cycle per instruction needed, but
it can issue 2 floating point multiplications in parallel per 3 clock
cycles. This reduces again to 1 clock cycle for 2 multiplications if
you manage to keep your pipeline filled.
I have no idea if you could make use of the fast floating point
multiplication in your hash problem, but in terms of performance this
would be very good.
with kind regards
Frank
------------------------------
Date: Wed, 29 Apr 1998 02:24:12 -0800
From: harry@NOSPAM.fizbin.com (Harry Zink)
Subject: Problemsinstalling Perl on Red Hat 5.0
Message-Id: <harry-2904980224120001@192.168.100.120>
When I try to install Perl on my RedHat 5. system (because the Perl
install under RH5.0 is broken), I get a string of errors and an inabili to
compile?
Anyone else failiar with this problem, and is there a fix?
Here's the errors I get, and I assume this has something to do with
improper libs.
---
Checking your choice of C compiler, libs, and flags for coherency...
I've tried to compile and run a simple program with:
cc -O2 -Dbool=char -DHAS_BOOL -L/usr/local/lib -o try try.c -lnet
-lnsl -lndbm -lgdbm -ldb -ldl -lm -lc -lposix -lcrypt
./try
and I got the following output:
/usr/lib/libnet.so: undefined reference to `threadedAccept'
/usr/lib/libnet.so: undefined reference to `makeJavaString'
/usr/lib/libnet.so: undefined reference to `threadedWrite'
/usr/lib/libnet.so: undefined reference to `AllocArray'
/usr/lib/libnet.so: undefined reference to `threadedConnect'
/usr/lib/libnet.so: undefined reference to `threadedRecvfrom'
/usr/lib/libnet.so: undefined reference to `AllocObjectArray'
/usr/lib/libnet.so: undefined reference to `javaString2CString'
/usr/lib/libnet.so: undefined reference to `SignalError'
/usr/lib/libnet.so: undefined reference to `threadedSocket'
/usr/lib/libnet.so: undefined reference to `AllocObject'
/usr/lib/libnet.so: undefined reference to `threadedRead'
I can't compile the test program.
(The supplied flags might be incorrect with this C compiler.)
You have a BIG problem. Shall I abort Configure (and explain the problem)
[y]
Ok. Stopping Configure.
---
Furthermore, earlier in the Configure ocess, I also received the following
messages that certain libs are missing. Where can I get theselibs, and how
do I install tm?
---
Checking for optional libraries...
No -lsfio.
Found -lnet (shared).
No -lsocket.
No -linet.
Found -lnsl (shared).
No -lnm.
Found -lndbm (shared).
Found -lgdbm (shared).
No -ldbm.
Found -ldb (shared).
No -lmalloc.
Found -ldl (shared).
No -ldld.
No -lld.
No -lsun.
Found -lm (shared).
Found -lc (shared).
No -lcposix.
Found -lposix.
No -lndir.
No -ldir.
Found -lcrypt (shared).
No -lucb.
No -lBSD.
No -lPW.
No -lx.
Some versions of Unix support shared libraries, which make executables smaller
but make load time slightly longer.
---
Thanks for any help.
Harry
------------------------------
Date: Wed, 29 Apr 1998 00:45:58 -0600
From: troxel@sammcgees.com
Subject: Re: Reg Exp problem
Message-Id: <6i6eqm$433$1@nnrp1.dejanews.com>
> ++ Any pointers on an example or module that would help would be greatly
> ++ appreciated.
>
> I think people who are not able to search CPAN should not be given
> task that require more than 2 lines of code.
>
> Abigail
Well exxxccccuuuusssee me. I did search CPAN and did not find anything
that would even come close to helping with my specific problem.
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Wed, 29 Apr 1998 00:52:16 -0700
From: "Larry Rosler" <lr@hpl.hp.com>
Subject: Re: Splitting a variable ???
Message-Id: <6i6m8q$i3f@hplntx.hpl.hp.com>
Martien Verbruggen wrote in message
<6i5p9v$lck$2@comdyn.comdyn.com.au>...
>In article <wxxd8e1r432.fsf@refil.ifi.uio.no>,
> Terje Kvernes <terjekv@ifi.uio.no> writes:
>> "Igor Krivokon" <igor.k@usa.net> writes:
>>
>>> $string = "042498a";
>>> ($a, $b, $c, $d ) = $string =~ /(\d\d)(\d\d)(\d\d)(\w)/;
>>
>> why not \d{2} instead of \d\d? Hm...
>
>Because \d\d is 4 characters, and \d{2} 5? :)
Because \d\d is a bit faster! :)
#!/usr/local/bin/perl -w
use strict;
use Benchmark;
use vars qw( $string );
$string = '042498a';
timethese (100000, {
'looped' => q{
my ($a, $b, $c, $d) = $string =~ /(\d{2})(\d{2})(\d{2})(\w)/;
},
'unrolled' => q{
my ($a, $b, $c, $d) = $string =~ /(\d\d)(\d\d)(\d\d)(\w)/;
},
} );
Benchmark: timing 100000 iterations of looped, unrolled...
looped: 13 secs ( 6.08 usr 0.02 sys = 6.10 cpu)
unrolled: 13 secs ( 5.70 usr 0.02 sys = 5.72 cpu)
--
Larry Rosler
Hewlett-Packard Laboratories
lr@hpl.hp.com
------------------------------
Date: 29 Apr 1998 11:16:30 +0200
From: Calle Dybedahl <qdtcall@esb.ericsson.se>
Subject: Re: Sys::syslog not working?
Message-Id: <iszph5rnrl.fsf@godzilla.kiere.ericsson.se>
Marc.Haber-usenet@gmx.de (Marc Haber) writes:
> I am trying to have a perl script log something on the syslog on a
> Linux box. I am using the example from the Camel book. That program
> does: nothing. There is nothing being logged to syslog. syslog.ph is
> present on the system.
You have set up syslog on your machine to log entries of severity
info, haven't you? If you haven't, syslogd is just throwing away what
you send to it.
--
Calle Dybedahl, UNIX Sysadmin
qdtcall@esavionics.se http://www.lysator.liu.se/~calle/
------------------------------
Date: Wed, 29 Apr 1998 09:27:01 +0100
From: Simon Matthews <sam@peritas.com>
Subject: Re: techniques for tagging substitution areas in templates?
Message-Id: <3546E454.6E02C9A0@peritas.com>
Eric Bohlman wrote:
> dtbaker@flash.net wrote:
> : encouraging, but I must be missing something... I checked out the Text::
> : module docs and source, and did not find a Text::Template module. I have the
> : 5.004_02 GS release, and the modules listed are: Abbrev.pm, ParseWords.pm,
> : Soundex.pm, Tabs.pm, Wrap.pm
>
> : I am new to perl, and may be looking in the wrong place? If you could be a
> : little more specific about where I can find info on the module, it would
> : really help me out...
>
> Text::Template isn't part of the default distribution (which would be way
> too big if every possibly useful module was included). The place to get
> standard modules that aren't part of the distribution is the Comprehensive
> Perl Archive Network (CPAN), which can be found at
> <URL:http://www.perl.com/CPAN/>.
We make extensive use of Text::MetaText for this kind of stuff.
------------------------------
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 2452
**************************************