[12066] in Perl-Users-Digest
Perl-Users Digest, Issue: 5666 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 14 20:07:12 1999
Date: Fri, 14 May 99 17:00:17 -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, 14 May 1999 Volume: 8 Number: 5666
Today's topics:
/usr/bin/perl vs /usr/local/bin/perl <mflaherty2@earthlink.net>
Re: /usr/bin/perl vs /usr/local/bin/perl (Alastair)
Re: CPAN-POD & pulling my hair OUT! HELP! do the doc's (Charles Lindsey)
Email Attachments w/o MAIL, MIME, or NET modules rmason@hal-pc.org
Re: encoding query strings manually? <ebohlman@netcom.com>
Re: FAQ 4.14: How can I find the Julian Day? <cassell@mail.cor.epa.gov>
Re: How to share vars across files? <cassell@mail.cor.epa.gov>
Re: I need some help (Tad McClellan)
Re: man pages and FAQs: why posted? <jbc@shell2.la.best.com>
Re: man pages and FAQs: why posted? (I R A Aggie)
Microsoft IIS4 <lone.wolf@net.ntl.com>
Re: Microsoft IIS4 (Michel Dalle)
Re: Ok, here I go... Help! (Tim Herzog)
Re: Real Time file access (Jeffrey Horn)
Re: Sending E-Mail via PERL (CGI) (Tim Herzog)
Re: SimNet - Perl proxy governor project <cassell@mail.cor.epa.gov>
Re: Simple Q: How to print the string aaa*bbbccc? <cassell@mail.cor.epa.gov>
Re: Small amount of Perl CGI script work needed for sit <ebohlman@netcom.com>
Re: Sorting is too slow for finding top N keys... - GOT (Michel Dalle)
Re: string manipulation with form submissions (Larry Rosler)
Re: Using cmp on data fetched via Odbc (Tad McClellan)
Re: Using cmp on data fetched via Odbc (Larry Rosler)
Re: Which book do you recommend? <cassell@mail.cor.epa.gov>
Re: XSub receiving reference to hash array. (Arved Sandstrom)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 14 May 1999 18:28:02 -0400
From: "Mike Flaherty" <mflaherty2@earthlink.net>
Subject: /usr/bin/perl vs /usr/local/bin/perl
Message-Id: <7hi806$bak$1@oak.prod.itd.earthlink.net>
Hi,
I installed perl into /usr/local/bin/perl. This has been fine excpet now I
am working with a package that has about 40 .pl files that all reference
/usr/bin/perl.
Should I...
1) place a link from /usr/bin/perl to /usr/local/bin/perl?
2) Reinstall perl and reply "yes" to the part that asks if I want it
installed in /usr/bin/perl too. I didn't do this initially because I only
had a couple of perl scripts and limited space on the /usr (seperate from
/usr/local) partition.
3) Replace all of the headers with /usr/local/bin/perl.
If anyone knows a good sed command for three it would be cool.
Thanks,
Mike Flaherty
------------------------------
Date: Fri, 14 May 1999 22:59:53 GMT
From: alastair@calliope.demon.co.uk (Alastair)
Subject: Re: /usr/bin/perl vs /usr/local/bin/perl
Message-Id: <slrn7jpe9v.59.alastair@calliope.demon.co.uk>
Mike Flaherty <mflaherty2@earthlink.net> wrote:
>
>
>1) place a link from /usr/bin/perl to /usr/local/bin/perl?
Hardly earth shattering! Make a link. Problem solved.
--
Alastair
work : alastair@psoft.co.uk
home : alastair@calliope.demon.co.uk
------------------------------
Date: Fri, 14 May 1999 13:49:44 GMT
From: chl@clw.cs.man.ac.uk (Charles Lindsey)
Subject: Re: CPAN-POD & pulling my hair OUT! HELP! do the doc's really suck this bad?
Message-Id: <FBq6Ew.78r@clw.cs.man.ac.uk>
In <3739C41F.3E7C@atanytimeonthe.net> N <nospam@atanytimeonthe.net> writes:
>I really don't want to go to each module's ".tar.gz" file and extract
>the docs, that's a real big waste of time and doesn't allow for
>searching within docs very well.
It would be nice if one of the mirroring sites could keep all the module
texts in a directly ftpable form, so you could go and browse for anything
that you were missing, or not sure about. Not to keep any other source
codes, etc, of course, so people would not try to download the complete
thing that way.
--
Charles H. Lindsey ---------At Home, doing my own thing------------------------
Email: chl@clw.cs.man.ac.uk Web: http://www.cs.man.ac.uk/~chl
Voice/Fax: +44 161 437 4506 Snail: 5 Clerewood Ave, CHEADLE, SK8 3JU, U.K.
PGP: 2C15F1A9 Fingerprint: 73 6D C2 51 93 A0 01 E7 65 E8 64 7E 14 A4 AB A5
------------------------------
Date: Fri, 14 May 1999 21:49:03 GMT
From: rmason@hal-pc.org
Subject: Email Attachments w/o MAIL, MIME, or NET modules
Message-Id: <373c999e.2502647@news.hal-pc.org>
How do I tell the sendmail program that I want to include an Excel
file attachment with the email that goes out? I can send email OK,
but my ISP has not installed MAIL::Sendmail, MIME::Lite, or NET::SMTP.
Rusty Mason
------------------------------
Date: Fri, 14 May 1999 23:24:56 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: encoding query strings manually?
Message-Id: <ebohlmanFBqx1K.CHr@netcom.com>
Ken <ksanders@sandnarrows.com> wrote:
: So convert something like: the blue hat!!! to a value that will be
: acceptable as a query string. Converting the spaces to + is easy enough,
: its the next stage of converting the symbols etc, that I have a problem
: with.
Use the URI::Escape module.
------------------------------
Date: Fri, 14 May 1999 16:12:16 -0700
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: FAQ 4.14: How can I find the Julian Day?
Message-Id: <373CADD0.ED6CF5A6@mail.cor.epa.gov>
Larry Rosler wrote:
>
> [a bunch of drivel from me snipped]
>
> Methinks you are looping along with the FAQ reposts, David. :-)
Yep. Only this time I was trying to post some more *useful*
addenda, rather than a less-than-helpful question.
> You are wrong about the origin of 'Julian' in 'Julian Day'. According
> to the (somewhat authoritative?) sources I have found, it has little or
> nothing to do with the Julian calendar.
Good! Because some of the questions I have seen in other newsgroups
seemed very definitely to be thinking of a link to the Julian
Calendar.
> From the same source, worth reiterating (as I posted in *my* last turn
> through this loop. ObPerl: This refers to the $yday return value of
> (gm|local)time and the '%j' specifier of POSIX::strftime()):
Hmmm. I read all your posts. I wonder how I could have missed
that one?
> The system of Julian days should not be confused with the simpler system
> of the same name which associates a date with the number of days elapsed
> since January 1st of the same year (according to which 2000-12-31 is day
> 366 of the year 2000).
So there's at least one more pseudo-julian-day which the
reader might want, which is easily handled in Perl. Does this
FAQ need a pop quiz at the front?
David
--
David L. Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Fri, 14 May 1999 16:31:04 -0700
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: How to share vars across files?
Message-Id: <373CB238.FA0D4144@mail.cor.epa.gov>
Jalil Feghhi wrote:
>
> I have a couple of perl files and need to share some vars across my files
> (export them in one file and import it in another). I am using 'use strict'
> in all my files.
>
> Is there a way to do this?
Yep. There's several ways. But you probably want to look into 'do'.
As in:
do 'exported_vars.pl';
Try:
perldoc -f do
to read more about this, and to see why you don't want to use this
for library modules.. and why you don't want to do this:
eval `cat exported_vars.pl`;
HTH,
David
--
David L. Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Fri, 14 May 1999 12:06:34 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: I need some help
Message-Id: <amhhh7.s84.ln@magna.metronet.com>
Randal L. Schwartz (merlyn@stonehenge.com) wrote:
: >>>>> "tex2121" == tex2121 <tex2121@my-dejanews.com> writes:
: tex2121> I am trying to write a Perl program that displays the n most freqent m
: tex2121> word sequences in an arbitrary number of input files. n , m and the
: tex2121> input file names should be specified on the command line. The program
: It was determined on alt.perl that this was a homework problem.
: Let's not be helping the poor student, please. :(
Gak! Now I feel guilty.
If you have the instructor's (or even just what school's) email
address, please let me know and I will send an apologetic
email to him.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 14 May 1999 21:11:13 GMT
From: John Callender <jbc@shell2.la.best.com>
Subject: Re: man pages and FAQs: why posted?
Message-Id: <373c9171$0$211@nntp1.ba.best.com>
Lee <rlb@intrinsix.ca> wrote:
> I have been reading this ng for quite a while, and also surmised those same
> reasons. But I don't think it will be effective, and I think it is an
> enormous waste of bandwidth.
I think this "enormous waste of bandwidth" charge is suspect. What do
you really mean by it? That the downloading of the headers for these
articles consumes too much of your modem connection? That the
downloading of the text of the articles by your news server is slowing
it down, or using up its disk? That the storing and forwarding of these
articles around the net is causing undue load on the overall
infrastructure? If you mean any of these things, I think you're on
shaky ground. Downloading the headers takes an instant, while the vast
majority of Usenet bulk (and general net traffic, for that matter) is
not text, but image binaries. In that context, I don't think Tom's
auto-postings amount to a hill of beans.
Perhaps you're using "bandwidth" in the more slippery sense: the
bandwidth between your eyeballs and your frontal lobes, or, more
specifically, the time limitation you face in trying to find
interesting Usenet articles to read and respond to. If that's the case,
you may have a point, though your personal definitions of "interesting"
and "uninteresting" will have to be compared to those of other users of
the group if any sort of general consensus about whether these articles
constitute a "waste" (to say nothing of an "enormous waste") is to be
arrived at. Also, the Subject: convention Tom follows with these
articles makes it trivial to filter them out automatically, which would
seem to be a superior solution for folks who don't want to see them.
Too often, I think, people either consciously or unconsciously try to
cloak their personal dislike of a particular sort of Usenet content in
a mantle of "bandwidth preservation," as if denying the rest of the
community the opportunity to read articles they themselves find
uninteresting is some sort of noble impulse aimed at preserving the
commons.
--
John Callender
jbc@west.net
http://www.west.net/~jbc/
------------------------------
Date: 14 May 1999 22:21:19 GMT
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: man pages and FAQs: why posted?
Message-Id: <slrn7jp8jt.idp.fl_aggie@stat.fsu.edu>
On 14 May 1999 21:11:13 GMT, John Callender <jbc@shell2.la.best.com>, in
<373c9171$0$211@nntp1.ba.best.com> wrote:
[about bandwidth]
+ In that context, I don't think Tom's auto-postings amount to a hill
+ of beans.
There's a porno spammer named Saylor. His idea of a good time is to
upload a couple of gigabytes of his spam to Usenet over a weekend...
I don't think the FAQs, as posted, consume as much as 1% of that
particular spammer's abuse...
+ Too often, I think, people either consciously or unconsciously try to
+ cloak their personal dislike of a particular sort of Usenet content in
+ a mantle of "bandwidth preservation," as if denying the rest of the
+ community the opportunity to read articles they themselves find
+ uninteresting is some sort of noble impulse aimed at preserving the
+ commons.
I'd recommend killfiling based on something like (the ObPerl part :) :
if ($subject=~/^FAQ/) { next; } # eliminate the initial posting, but
# preserves correctly formatted (Re:)
# followups...
James
------------------------------
Date: Fri, 14 May 1999 21:41:00 +0100
From: "Lone Wolf" <lone.wolf@net.ntl.com>
Subject: Microsoft IIS4
Message-Id: <373c8829.0@145.227.194.253>
I cant get perl to work with my IIS version 4 server.
I am using the activestate perl software but it doesnt seem to be working.
I used to get errors telling me that I couldn't access that directory, fixed
that.
Then I got the script that I was trying to run, the script was a text file
that was just displayed in the browser window.
Now after reinstalling the activestate perl software I have checked all the
settings for the perl script directory (execute (including script), and
other settings) checked the settings on the actual perl file. NOW when you
try to access the script it just seems to sit there trying to access it and
does nothing.
PLEASE PLEASE could you give me ANY suggestions.
Copy of the scipt I am trying to run follows :-
print "HTTP/1.0 200 OK\n\n";
print "Content-Type: text/html\n\n";
print "<HTML>\n";
print "<HEAD>\n";
print "<TITLE>Hello World</TITLE>\n";
print "</HEAD>\n";
print "<BODY>\n";
print "<H4>Hello World</H4>\n";
print "<P>\n";
print "Your IP Address is $ENV{REMOTE_ADDR}.\n";
print "<P>";
print "<H5>Have a nice day</H5>\n";
print "</BODY>\n";
print "</HTML>\n";
You may recognise this as it is the test that microsoft suggest you use to
see if your IIS server is running perl scripting properly.
Thanks...
------------------------------
Date: Fri, 14 May 1999 21:55:12 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: Microsoft IIS4
Message-Id: <7hi62a$8a4$4@xenon.inbe.net>
In article <373c8829.0@145.227.194.253>, "Lone Wolf" <lone.wolf@net.ntl.com> wrote:
>I cant get perl to work with my IIS version 4 server.
[a long list of actions snipped]
Have you REALLY looked at the ActivePerl FAQ ? There's a nice chapter that's
called : "How do I configure IIS 4.0 to support Perl for Win32?"
There is also some documentation on IIS 4.0 about Perl, in case this doesn't
work.
There is also a newsgroup called comp.infosystems.www.servers.ms-windows,
that sometimes deals with IIS4 problems.
There is also a newsgroup called microsoft.public.inetserver.iis, that also
deals with IIS4 configuration problems.
There are also more than 50 articles on search.microsoft.com.
There is, however, nothing in your question that corresponds to what this
newsgroup is all about, i.e. Perl itself :-)
Good luck,
Michel.
------------------------------
Date: Fri, 14 May 1999 17:59:00 -0500
From: therzog@knotech.com (Tim Herzog)
Subject: Re: Ok, here I go... Help!
Message-Id: <therzog-1405991759000001@therzog-host105.dsl.visi.com>
In article <XF__2.2313$O3.71384@news12.ispnews.com>, "Bruce"
<bruce@pond.net> wrote:
>I should be sailing...
>
>But instead, I've spent the last two weeks trying to get a simple perl
>script to work! I actually want to install some CGI-World scripts and
>thougth it would be good to get perl, make sure I could install it, and make
>sure I could actually get something to run... (dumb idea! ;-) To whom ever
>attempts to help me, thanks in advance, it will become appearent that I'm
>pretty clueless on most of this. I've read lots of FAQ's and pages of
>"stuff" but it is all just swimming around like a vortex... slowly but
>surely drawing me down into the abyss!
>
>After a few days of searching for a version of perl, that I could actually
>install on my NT workstation (Web Development) and our NT Server (Live Web
>server) I finnally found ActiveStates Active perl. I installed it, fine (two
>days later I figured out that is wasn't really working yet... or was sort
>of ) and fixed that... I can't get it installed on the Live Web Server (but
>that Might just be because I've tried to run the install with web services
>running).
>
>So, I have this simple little page that I want to make work. I swiped
>(stole? flattered?) it off of a site, www.echoecho.com, and downloaded
>FormMail.pl from Matt's script archive. which it appears to require. I'm
>not really sure if it needs "FormMail.pl" 26k or "mailform.pl/cgi" 6k. I've
>tried pointing to both.
>
>http://viper.thinairad.com/ardvarkhill/tell_a_friend_cgi.html
>
>I want it to take in: My name, My e-mail address, My Message, and the e-mail
>address of 3 friends. I then want it to e-mail a message from me to each of
>my 3 friends, including a link back to the really great "aardvarkhill.com"
>site. It would also be nice if it confirmed to me that all this had been
>done by giving my browser the
>http://viper.thinairad.com/aardvarkhill/tell_a_friend_confirm.html page
>which is formatted but not working either.
>
>I know that perl is working on my server, because I can run a "hello world"
>test, at there browser that works. (with the pl extension,
>http://viper.thinairad.com/aardvarkhill/cgi-bin/helloworld.pl )
>
>When I try to use the form, (submit) it tries to open a file/download
>"mailform.pl from viper.thinairad.com" If I change the extension to .cgi, it
>returns an error saying that mailform.cgi is not a valid application. yet if
>I open a command prompt window, or 2x click on the cgi version from the file
>explorer, it will open a dos window, run the program correctly and then
>close the window (this is very fast, but visible)
>
>Also, at various attempts I've been able to generate some prel/script error
>messages that appear to come from FormMail.pl. When I am able to get
>something to work, I get a "recipient" not defined error, and I'm also not
>at all sure if I have to have a mail server installed on my machine or on
>our live server for this to work. One of the readme's tells me:
>
>"First, make sure you have DevMailer 1.0. This can be downloaded for free
>from Geocel International, at: http://www.geocel.com/devmailer/"
>
>But it doesn't say why I need it, or what it does. It also is $99 "free!"
If the script runs fine from a command prompt (i.e., not via CGI), then
the script is fine. You don't say when the program runs "correctly" this
way, whether the email gets to the destination. Assuming it does, then
the problem is in your web page, and it's a CGI problem, not a perl
problem. Check the <INPUT TYPE=HIDDEN> tags to make sure they're correct,
and the ACTION parameter in the <FORM> tag is correct.
--
Tim Herzog
------------------------------
Date: 14 May 1999 23:51:49 GMT
From: horn@wheel.cs.wisc.edu (Jeffrey Horn)
Subject: Re: Real Time file access
Message-Id: <7hicul$8an@spool.cs.wisc.edu>
By default you are buffering the output. Try putting the line:
$|=1;
somewhere before the while loop, to indicate that you don't want to
buffer the output.
> How would I go about reading from a pipe in real time. I currently do
> something like this
> open(F,"cat somefile|") {
> while(<F>) {
> print("$_\n");
> }
> close(F);
>
> This currently works ok but it has pauses every few seconds then dumps a
> bunch of output.
-- Jeff Horn
--
Jeffrey Horn (horn@cs.wisc.edu) |BELZER,BERNHARDT,BOETTCHER,DRAVIS,FETTER
PHONE:(608) 846-1932 |GAPINSKI,GAUGER,HARMS,HIRSCHINGER,HORNE
FAX: (608) 846-1934 |JUECH,KLAJBOR,KROIS,KRONING,LEMKE,RUNGE
http://www.cs.wisc.edu/~horn/horn.html |STOCK,TAUBERT,TRESKE,WILLMERT,ZILLMER
------------------------------
Date: Fri, 14 May 1999 17:49:23 -0500
From: therzog@knotech.com (Tim Herzog)
Subject: Re: Sending E-Mail via PERL (CGI)
Message-Id: <therzog-1405991749230001@therzog-host105.dsl.visi.com>
In article <7hi2nu$rpc$1@news6.svr.pol.co.uk>, "Mug-O-Milk"
<webmaster@*nospam*mugomilk.freeserve.co.uk> wrote:
>How do you send E-Mail (i.e. a confirmation e-mail) using Perl?
>I'm semi new to perl, so a list of commands would be fine, as I don't
>understand it in me LLAMA book :O(
I'm sure there's a module out there that can do this better (check CPAN),
but here's the quick and dirty method:
open EMAIL, "|/usr/lib/sendmail -t" or die "Can't open sendmail $!";
print EMAIL<<THEEND
To: recipient\@somewhere.com
From: sender\@somewhere.com
Subject: subject
Text of the message here
THEEND
Perhaps someone else can suggest modules that are less platform dependent
and/or safer and/or more flexible.
--
Tim Herzog
------------------------------
Date: Fri, 14 May 1999 15:38:09 -0700
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: SimNet - Perl proxy governor project
Message-Id: <373CA5D1.F9955411@mail.cor.epa.gov>
Charles R. Thompson wrote:
>
> [ Congratulations, Randal L. Schwartz you could be a winner! Return to
> comp.lang.perl.misc to claim your prize. ]
>
> In article <m1btfn5z4m.fsf@halfdome.holdit.com>, Randal L. Schwartz
> says...
> > You could base it on a combination of work I've already done for my
> > WebTechniques columns... in particular, I have a throttling CGI, and a
> > pre-forking web-proxy-server... you'd just need to combine the two. :)
> > My columns are online (thank you Miller Freeman!) at
> >
> > http://www.stonehenge.com/merlyn/WebTechniques/
>
> Good to see it is possible. I had a feeling it wasn't anything too
> incredibly original. In the least, I was certain somebody had probably
> gotten real close.
>
> [snip of last para]
And if you want to be able to sim a heavy site load at random,
you wouldn't need to build a chaotic generator [even though we
probably have one in Math::TrulyRandom]. Just some simple
queueing theory. Exponential distributions are easy.. and
anything ickier that comes up could be handled using
Math::Random.
David
--
David L. Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Fri, 14 May 1999 15:56:34 -0700
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: Simple Q: How to print the string aaa*bbbccc?
Message-Id: <373CAA22.6B9B4A5D@mail.cor.epa.gov>
Bart Lateur wrote:
>
> David L. Cassell wrote:
> [snip]
> >the quotemeta function
>
> SAY WHAT?
>
> This function takes a string, and puts a backslash in front of every
> non-word character.
Of course, you're right. I was rushing off to a meeting and
didn't bother to think that one through. Mea culpa.
David
--
David L. Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Fri, 14 May 1999 23:53:51 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Small amount of Perl CGI script work needed for site.
Message-Id: <ebohlmanFBqyDr.E3K@netcom.com>
Mike Arndt <webmaster@film.tierranet.com> wrote:
: In article <7hhrdc$k4m$1@nnrp1.deja.com>, David Turley <dturley@pobox.com> wrote:
: >You mean so I could write perl script to use your site to spam people?
: >Cool!
: This would not be spam as it would simply be people wno know each other
: alerting each other of products. Spam is generally defined as unsolicited
: e-mail being sent to people. When two people know each other and e-mails are
: sent to them because they have a relationship online it is not spam because it
: is not unsolicited.
He's not claiming that the *intended* use of *your* script is to spam,
he's pointing out that unless you build in a whole lot of security
features, it would be trivial for someone else to write a script that
would connect to the script on your site and push spam through it.
Actually, since the script could only send content defined by you, the big
problem is mailbombing rather than spamming. Such a script should
maintain a record of the addresses each document has been sent to (a dbm
file would be a great way to do this) and refuse to send a document to an
address that's already received it. If for privacy reasons you don't want
to maintain identifiable records of recipients (e.g. you're running a goth
music site and you don't want the FBI to be able to subpoena the list of
recipients to conduct a post-Littleton witch hunt--something like this has
actually happened), then just compute the MD5 (or SHA) hash of
($document_URL.$recipient_address) and store that (with any value) in your
dbm--in fact if the documents have long URLs, that will use less space
then storing the data directly and you might as well do it.
------------------------------
Date: Fri, 14 May 1999 22:21:16 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: Sorting is too slow for finding top N keys... - GOT IT !
Message-Id: <7hi7j7$bfn$1@xenon.inbe.net>
In article <MPG.11a61a557361f40a989a66@nntp.hpl.hp.com>, lr@hpl.hp.com (Larry Rosler) wrote:
[snip]
>Below is the revised description. Unless someone offers correction or
>improvement, I'll ask Daniel Grisinger to update it in the Perl Function
>Repository.
>
>As for the competing performance claims of the other selection
>algorithms offered in this thread, I'm a bit out of tuits to keep
>comparing them, especially when I'm not sure this is the best approach
>(compared to 'sort-and-slice') for other than humongous data sets.
[snip]
Sounds good. I'd like to add that for 'older' versions of Perl, there also
seems to be some CPU-related (?) bottleneck for much smaller amounts
of data (remember the 31013 dataset with Perl5.003 that took ages ?).
So basically, I'd say this :
"if the 'normal' perl sort takes ages, try this one !"
>I hope others have found this problem as instructuve as I have!
Yep. I haven't gotten the latest version of Marko working yet (waiting for
feedback), but my conclusions are as follows (for my type of data !) :
- fast system with big memory : sort and slice
- slow system with big memory : Bart1 = reverse hash and sort that (for my
type of data, that is) Otherwise Marko's solution may be it ?
- fast system with low memory : LarryX
- slow system with low memory : probably LarryX
- old Perl5 version : Larry2
So, since I'm aiming at having my code run on any kind of system with any kind
of Perl5 on it, with big memory requirements in the script already, I think
I'll go for Larry2 after all.
Thanks for all the good stuff, people !
Michel.
------------------------------
Date: Fri, 14 May 1999 14:45:15 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: string manipulation with form submissions
Message-Id: <MPG.11a639448fb4dc59989a68@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <7hhtau$ldn$1@nnrp1.deja.com> on Fri, 14 May 1999 19:25:21
GMT, Vinh T. Bui <vinh.bui@medstat.com> says...
> I have a submission form with has a TEXTAREA. A user enters the
> following:
> line1
>
> line2
>
> line3
>
>
> I want to write this value to a text file on only ONE line. However
> when I read from this text file, the output will be in the same format
> as the input. (kinda like how this submit form is set up) Any
> suggestions?
Change the newline characters 'into something rich and strange' before
writing them; change them back to newlines when reading them.
$line =~ tr/\n/\0/;
print $line, "\n";
...
while (<FILE>) {
chomp;
tr/\0/\n/;
...
Presto, change-o!
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 14 May 1999 12:14:48 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Using cmp on data fetched via Odbc
Message-Id: <o5ihh7.s84.ln@magna.metronet.com>
Trainham Bradford (Bradford.Trainham@m1.irs.gov) wrote:
: print "IRS badge required \n") if (($data{h_idind} cmp "X") == 0);
^
^ where is the opening paren?
: Other than that I work for the IRS, what might I be doing wrong?
After fixing the syntax error, it works fine for me.
There is something you are not telling us.
(maybe there is a newline lurking at the end?)
Anyway it is kinda strange to use cmp when you want to test
for equality, since Perl has an operator for testing for
equality.
print "IRS badge required \n" if $data{h_idind} eq 'X';
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 14 May 1999 14:48:17 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Using cmp on data fetched via Odbc
Message-Id: <MPG.11a639fa84c7f72b989a69@nntp.hpl.hp.com>
In article <o5ihh7.s84.ln@magna.metronet.com> on Fri, 14 May 1999
12:14:48 -0400, Tad McClellan <tadmc@metronet.com> says...
> Trainham Bradford (Bradford.Trainham@m1.irs.gov) wrote:
>
> : print "IRS badge required \n") if (($data{h_idind} cmp "X") == 0);
> ^
> ^ where is the opening paren?
...
> Anyway it is kinda strange to use cmp when you want to test
> for equality, since Perl has an operator for testing for
> equality.
It is C. The idiom for testing equality of two strings is:
if (!strcmp(s1, s2)) ...
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 14 May 1999 15:52:25 -0700
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
Subject: Re: Which book do you recommend?
Message-Id: <373CA929.CFC368A0@mail.cor.epa.gov>
Lacrosse_20 wrote:
>
> Hey guys. I just posted this, but it isn't showing up in my list, so
> I'm reposting.
I trust you canceled your previous post before posting this one. :-)
> I am planning on buying a new "advanced" perl book, but
> I don't know which book would give me the best instruction for my $.
> The ones I'm looking at are Perl Cookbook; Tom Christiansen, et
> al, Programming Perl, 2nd Edition (covers Perl 5.0); Larry Wall
> (Editor), et al, Mastering Regular Expressions: Powerful Techniques for
> Perl and Other Tools; Jeffrey E. F. Friedl, and Advanced Perl
> Programming; Sriram Srinivasan. Which of these is the best? Maybe
I own all four. They're all good. Assuming you've already worked
through "Learning Perl", I would vote for "Programming Perl". It
has the detailed discussions you want to see before you get to the
other good stuff in the ram book and the panther book. You should
note, however, that many points in the camel have been updated in
the *on-line* docs you have on your system. They're there with the
installation.
In particular, while Jeffrey Friedl's book is a really good one,
it focuses on the version of Perl that was current when the book
was written. I know, you're saying, "Well, duh Dave, that was
totally obvious." But Perl regexen have improved in many subtle
ways since then. Some of the 'flaws' have been repaired or
revised or speeded up. Some regex features which will break other
languages/tools are caught by the Perl compiler and flagged first,
instead of inducing the troubles seen in earlier versions.
You can thank Ilya for that. So pick one of the others first.
> there's one out there that I didn't list that's better than these...if
> so, what is it? Thanks in advance for your input.
There are none better. There are one or two that are within
epsilon of 'as good'. And there's an extra advantage. When you
get stuck and you ask for help in this ng, you can have the
author [TomC or Randal] personally tell you about the embarrassing
typo in your submission. Oh, maybe that's not a plus. :-)
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Fri, 14 May 1999 18:17:27 -0300
From: Arved_37@chebucto.ns.ca (Arved Sandstrom)
Subject: Re: XSub receiving reference to hash array.
Message-Id: <Arved_37-1405991817270001@dyip-113.chebucto.ns.ca>
In article <LLX_2.6523$me.2887693@WReNphoon4>, sevigny@gis.net (Marc
Sevigny) wrote:
> Hello,
>
> I am trying unsuccessfully to declare an argument
> in an XSUB as being a reference to a hash array.
>
[ SNIPPAGE ]
>
> int foo(arrayRef)
> HV *arrayRef;
> .
When you pass a ref it's coming in as an SV *, so declare it as such.
Deref using SvRV. *That* will be your HV *.
Arved
------------------------------
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 5666
**************************************