[8444] in Perl-Users-Digest
Perl-Users Digest, Issue: 2061 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 10 01:08:06 1998
Date: Mon, 9 Mar 98 22:00:28 -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, 9 Mar 1998 Volume: 8 Number: 2061
Today's topics:
Re: Are There Any Snazzy Perl Editors for Windows? (Jason V. Robertson~)
Re: Arrays and system hangups <quentin@jihad.amd.com>
beginner troubles <penguin@tiac.net>
Re: beginner troubles <uri@sysarch.com>
Re: c.l.p.mod and TPI <tchrist@mox.perl.com>
Re: c.l.p.mod and TPI (Zachery J. Bir)
Re: c.l.p.mod and TPI (John Stanley)
Re: c.l.p.mod and TPI <joseph@5sigma.com>
Re: c.l.p.mod and TPI (Chip Salzenberg)
Re: c.l.p.mod and TPI (Chip Salzenberg)
Re: CGI query help! <uri@sysarch.com>
Re: CGI query help! (brian d foy)
Re: How do I translate PST to EST time? (Eric Weiss)
Re: How do I translate PST to EST time? <friedman@uci.edu>
Re: How do I translate PST to EST time? (brian d foy)
Perl and Distributed and Parallel Processing Question <lynchman@cyberenet.com>
Re: Perl Hash question <gregp@home.com>
Re: PerlW32 on NT, cannot use > or | why? (Eric Weiss)
Re: pty terminal control and IPC via pseudo-terminal de (Andrew M. Langmead)
Re: RegEx for HTML... (Abigail)
Since when is localtime(0) no longer 1970??? <mschilli@blaxxun.com>
Speed of sort routine vs. one-by-one compare (123) <snowe@rain.org>
Re: Speed of sort routine vs. one-by-one compare (123 (Paul Wolf)
Re: Speed of sort routine vs. one-by-one compare (123 <snowe@rain.org>
Re: Speed of sort routine vs. one-by-one compare (123 (Abigail)
Re: Speed of sort routine vs. one-by-one compare (123 <snowe@rain.org>
Re: The -w switch (was Re: better way to do this?) <rjk@coos.dartmouth.edu>
Re: The -w switch (was Re: better way to do this?) <joseph@5sigma.com>
Re: Tom, grow up [Re: The -w switch (was Re: better way (brian moore)
Re: using a scalar in an expression (Andrew M. Langmead)
Re: using a scalar in an expression <friedman@uci.edu>
Using regex to initial cap a name <ffinstad@best.com>
Re: Using regex to initial cap a name <egwong@netcom.com>
Re: Using regex to initial cap a name <tchrist@mox.perl.com>
Re: Using regex to initial cap a name (Abigail)
Re: Why I have a result such as 108.879999999999 (Eric Weiss)
Re: Win32 help request, rename problem <jackal@fastlane.net>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 10 Mar 1998 02:07:17 GMT
From: jvrobert@sedona.intel.com (Jason V. Robertson~)
Subject: Re: Are There Any Snazzy Perl Editors for Windows?
Message-Id: <6e278l$r7d@news.or.intel.com>
In article <35047F9C.7402@ibm.net>,
Charles Engelke <charles.engelke@ibm.net> wrote:
>Keith Turner wrote:
>>
>> Are there any text editors for windows that can recognize perl syntax and
>> color code and such?
>
>I've just got to give a plug to the GWD Text Editor by Vedran Gaco,
>available at http://www.iridis.com/gwd . I've never found an editor
>that could replace Brief for me until this one.
>
I don't know if this has been mentioned, but vim 5.0 (www.vim.org) is as
close to The Perfect Editor as is possible. Supports Perl, Python, Tcl as
"macro" languages, has syntax highlighting and smart automatic indention,
and has more features than most people could ever use. It's very fast, too.
Would be cool if they moved a bunch of it to a DLL, though. That way anytime
you load gvim after the first time would be very fast.
--
|Jason V. Robertson <jvrobert@sedona.intel.com> |
|Not speaking for Intel. |
------------------------------
Date: 09 Mar 1998 22:24:55 -0600
From: Quentin Fennessy <quentin@jihad.amd.com>
Subject: Re: Arrays and system hangups
Message-Id: <ximra4byxyg.fsf@jihad.amd.com>
>>>>> "BR" == Bindhu Rajaram <rajarmb@indy.tce.com> writes:
BR> I am having difficulty using perl and arrays. I have a file of
BR> approx 2meg size. I wish to split the data then store the data
BR> into arrays. My system hangs up. Is there a limitation to the
BR> array feature??
Bindhu-
Please provide us with a code example and a better description of the
failure mode. There is no particular size limit to Perl arrays. Your
computer may not be able to provide an additional 2MB of memory (or
VM) to the perl process.
--
Quentin Fennessy AMD, Austin Texas
------------------------------
Date: Mon, 09 Mar 1998 22:26:58 -0500
From: El Penguino <penguin@tiac.net>
Subject: beginner troubles
Message-Id: <3504B302.2AAD@tiac.net>
I'm trying to learn CGI w/Perl on my own. I downloaded the Perl 5
interpreter (on my Win95 PC) but looking at all these readme
instructions I'm totally lost. Would someone be willing to call me on
the phone and talk me through this mess. Please reply then I'll reply
with my phone number. Thanks.
------------------------------
Date: 09 Mar 1998 23:52:07 -0500
From: Uri Guttman <uri@sysarch.com>
To: El Penguino <penguin@tiac.net>
Subject: Re: beginner troubles
Message-Id: <x7d8fvuozs.fsf@sysarch.com>
El Penguino <penguin@tiac.net> writes:
> I'm trying to learn CGI w/Perl on my own. I downloaded the Perl 5
> interpreter (on my Win95 PC) but looking at all these readme
> instructions I'm totally lost. Would someone be willing to call me on
> the phone and talk me through this mess. Please reply then I'll reply
> with my phone number. Thanks.
1-900-perlsex :-)
i couldn't resist!
you will be better off getting a book like learning perl or one of the
perl CGI books. also look at ww.perl.com for lots of books, info, tutorials,
etc. on perl.
uri
--
Uri Guttman SYStems ARCHitecture and Software Engineering
uri@sysarch.com Have Perl, Will Hack
http://www.sysarch.com (781) 643-7504 x*2 FAX: (781) 643-2710
Try the Best Search Engine on the Net --------> http://www.northernlight.com
------------------------------
Date: 10 Mar 1998 02:38:39 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: c.l.p.mod and TPI
Message-Id: <6e293f$rj2$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
"Eric D. Friedman" <friedman@uci.edu> writes:
:Look, I'm all for moderating this group, but if you're going to
:outlaw advertisements, then outlaw it. Period. TPI stuff will be plenty
:visible at www.perl.org, www.perl.com, and on comp.lang.perl.announce
Web sites are irrelevant. Only a newsgroup matters here,
and comp.lang.perl.announce prohibits *ALL* even demi-commercial
postings, like book blurbs or conference adverts. Therefore,
no such forum exists.
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
Fungus doesn't take a vacation. --Rob Pike
------------------------------
Date: 10 Mar 1998 03:20:33 GMT
From: zbir@chaumas.suits.kiva.net (Zachery J. Bir)
Subject: Re: c.l.p.mod and TPI
Message-Id: <slrn6g9c80.425.zbir@chaumas.suits.kiva.net>
On 10 Mar 1998 02:38:39 GMT, Tom Christiansen <tchrist@mox.perl.com> wrote:
> [courtesy cc of this posting sent to cited author via email]
>
>In comp.lang.perl.misc,
> "Eric D. Friedman" <friedman@uci.edu> writes:
>:Look, I'm all for moderating this group, but if you're going to
>:outlaw advertisements, then outlaw it. Period. TPI stuff will be plenty
>:visible at www.perl.org, www.perl.com, and on comp.lang.perl.announce
>
>Web sites are irrelevant. Only a newsgroup matters here,
>and comp.lang.perl.announce prohibits *ALL* even demi-commercial
>postings, like book blurbs or conference adverts. Therefore,
>no such forum exists.
>
>--tom
Without trying to send c.l.p* spiralling into nauseating depths of
hierarchical obscurity, how about:
comp.lang.perl.announce.comm[ercial]?
or just open c.l.p.announce up to commercial postings, and have Subject tags:
[FREE] [COMMERCIAL] etc.?
Just a thought,
Zac
------------------------------
Date: 10 Mar 1998 04:17:53 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: c.l.p.mod and TPI
Message-Id: <6e2eth$7vs$1@news.orst.edu>
In article <6e293f$rj2$1@csnews.cs.colorado.edu>,
Tom Christiansen <tchrist@mox.perl.com> wrote:
>Web sites are irrelevant. Only a newsgroup matters here,
Since mailing lists are relevant, web sites are, too.
Either commercials are appropriate or they are not.
>and comp.lang.perl.announce prohibits *ALL* even demi-commercial
>postings, like book blurbs or conference adverts. Therefore,
>no such forum exists.
Then the correct action is to change the announce group to accept
announcements. If you believe that a moderated discussion group is the
correct place to post ads for classes for certain people, then it
certainly is appropriate to post them in a .announce group. They
aren't discussion, so they don't belong in a discussion group.
------------------------------
Date: Mon, 09 Mar 1998 22:20:12 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: c.l.p.mod and TPI
Message-Id: <3504CD13.53F604A9@5sigma.com>
That is disingenuous in the extreme.
-joseph
Chip Salzenberg wrote:
>
> According to "Eric D. Friedman" <friedman@uci.edu>:
[...] I'd be very surprised if any of these
> > folks voted against posting something that would be in their
> > financial best interests.
>
> Get used to be being surprised.
--
Joseph N. Hall, prop., 5 Sigma Productions mailto:joseph@5sigma.com
Author, Effective Perl Programming . . . . . http://www.effectiveperl.com
Perl Training . . . . . . . . . . . . . . . http://www.perltraining.com
Omniscient trash / Mr. Con Antithesis / In shortest, manic!
------------------------------
Date: Tue, 10 Mar 1998 00:12:34 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: c.l.p.mod and TPI
Message-Id: <6e20l2$5g1$1@cyprus.atlantic.net>
According to stanley@skyking.OCE.ORST.EDU (John Stanley):
>Quoting from the proposed charter:
>
>]In addition, the moderators will reject any article:
>]
>]+ which contains an advertisement or commercial solicitation
>] of any sort; (EXCEPTION: The Perl Insitute may post
>] commercials that its board deems to be of general interest
>] to the Perl community, such as announcements of upcoming
>] Perl-oriented conferences.)
>
>It would seem that this section of the charter needs to be reworded. It
>does say that non-TPI ads will be rejected.
It says that ads must be posted by TPI. It does NOT say that such ads
must have originated with or otherwise involve the affairs of TPI people.
--
Chip Salzenberg - a.k.a. - <chip@pobox.com>
"I brought the atom bomb. I think it's a good time to use it." //MST3K
-> Ask me about Perl training and consulting <-
Like Perl? Want to help out? The Perl Institute: www.perl.org
------------------------------
Date: Tue, 10 Mar 1998 00:10:35 GMT
From: chip@mail.atlantic.net (Chip Salzenberg)
Subject: Re: c.l.p.mod and TPI
Message-Id: <6e20hb$5fg$1@cyprus.atlantic.net>
According to "Eric D. Friedman" <friedman@uci.edu>:
>Chip Salzenberg <chip@pobox.com> wrote:
> > Perhaps you imagine that just because things are vetted by TPI that
> > therefore non-TPI ads will automatically be excluded. Nothing could
> > be further from the truth. But of course you'll have to see that to
> > believe it, unless my (and Tom's and Randal's and ...) word is enough.
>
>Immediately before the TPI exception, the RFD says
>
>[a posting will be excluded...]
>"+ which contains an advertisement or commercial solicitation
> of any sort;"
> ^^^^^^^^^^^^
>But you say that I'm "imagining" that non-TPI ads will automatically
>be excluded.
You miss the point. As you know, TPI can override the no-commercial
safeguards. What I am explaining is that commercial postings related
to the activities of TPI's board members will *not* necessarily be the
only ones that TPI will post. For example, "buy this book" posts
would likely be acceptable, even if the given book was not published
by O'Reilly or (co-)written by a TPI board member.
There are places for trust in the world. This is one of them.
>Anyway, my greater concern is with the part of the RFD that excludes
>any posting
>+ which is, in the opinion of the moderation panel,
> otherwise unsuitable for posting;
>what's the purpose of enumerating specific criteria if arbitrary
>"opinion" can always trump the published rules?
It's necessary to be sure that people don't subvert the spirit of the
rules by following the letter. It's a safety valve.
--
Chip Salzenberg - a.k.a. - <chip@pobox.com>
"I brought the atom bomb. I think it's a good time to use it." //MST3K
-> Ask me about Perl training and consulting <-
Like Perl? Want to help out? The Perl Institute: www.perl.org
------------------------------
Date: 09 Mar 1998 23:48:41 -0500
From: Uri Guttman <uri@sysarch.com>
To: "Fred" <cdm@sympatico.ca>
Subject: Re: CGI query help!
Message-Id: <x7g1krup5i.fsf@sysarch.com>
"Fred" <cdm@sympatico.ca> writes:
> I'm trying to make a CGI query using the folloing line of code in VB5. The
> query work fine with the form found in datek.htm but does not return the
> right qsymbol in VB. What's wrong with my query?
let me be the first (i hope) to say, what does this have to with perl?
you even mention (spit) visual basic, a product of uncle bill's micro$hit!
> begin 666 datek.htm
snip binary data
> end
uri
--
Uri Guttman SYStems ARCHitecture and Software Engineering
uri@sysarch.com Have Perl, Will Hack
http://www.sysarch.com (781) 643-7504 x*2 FAX: (781) 643-2710
Try the Best Search Engine on the Net --------> http://www.northernlight.com
------------------------------
Date: Tue, 10 Mar 1998 00:03:13 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: CGI query help!
Message-Id: <comdog-ya02408000R1003980003130001@news.panix.com>
Keywords: from just another new york perl hacker
In article <6e2a19$dij$1@news21.bellglobal.com>, "Fred" <cdm@sympatico.ca> posted:
>I'm trying to make a CGI query using the folloing line of code in VB5. The
>query work fine with the form found in datek.htm but does not return the
>right qsymbol in VB. What's wrong with my query?
> myStr =
>"https://orders.datek.com/cgi-bin/trading/vfpwebn.exe?qsymbol=INTC&getquote=
>Get%20Quote"
> Text1.Text = Inet1.OpenURL(myStr)
>Badly, I can't give my user and password for you guys to try!
doesn't matter because you're in the wrong place. go talk to some
VB5 folks.
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
------------------------------
Date: Mon, 9 Mar 1998 21:59:45 -0500
From: eweiss@winchendon.com (Eric Weiss)
Subject: Re: How do I translate PST to EST time?
Message-Id: <MPG.f6e76ab39b268749896bf@news.dgsys.com>
Add 3 hours. Adjust for midnight.
Eric
------------------------------
Date: 10 Mar 1998 02:59:24 GMT
From: "Eric D. Friedman" <friedman@uci.edu>
Subject: Re: How do I translate PST to EST time?
Message-Id: <6e2aad$64f@news.service.uci.edu>
In article <6e286t$gio$1@newse2.tampabay.rr.com>,
Jeff Tomich <fuzzy@tampabay.rr.com> wrote:
<Wanting to write a script to take the PST time and translate or equate it to
<EST time. How is this done?
use constant SECSPERHOUR => 60 * 60;
my $zone = 3;
my $time = time(localtime()) + ($zone * SECSPERHOUR);
should do it, I think. If you need to manipulate stringified times,
look into Date::* at CPAN.
--
Eric D. Friedman
friedman@uci.edu
------------------------------
Date: Tue, 10 Mar 1998 00:04:31 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: How do I translate PST to EST time?
Message-Id: <comdog-ya02408000R1003980004310001@news.panix.com>
Keywords: from just another new york perl hacker
In article <6e286t$gio$1@newse2.tampabay.rr.com>, "Jeff Tomich" <fuzzy@tampabay.rr.com> posted:
>Wanting to write a script to take the PST time and translate or equate it to
>EST time. How is this done?
you add three hours. the various Date::* modules might be helpful.
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
------------------------------
Date: Tue, 10 Mar 1998 00:02:27 -0500
From: "Lynch Man" <lynchman@cyberenet.com>
Subject: Perl and Distributed and Parallel Processing Question
Message-Id: <3504c961.0@news.cyberenet.net>
I am researching Perl v5.0 for a Computer Language Theory and Design Class
project. I am searching for information concerning Perl and it's ability
and support of distributed and parallel processing. Basically, I am looking
for these topics:
- Multiple Processes
- Semaphores
- Monitors
- Rendezvous
- Synchronization
- Message Passing
If anyone knows of any books or web pages, or they themselves can provide
any information on these subjects it would be greatly appreciated.
Thanks,
Peter Foley
foleyp1@alpha.lasalle.edu
------------------------------
Date: Tue, 10 Mar 1998 03:15:13 +0000
From: Gregory Propf <gregp@home.com>
Subject: Re: Perl Hash question
Message-Id: <3504B041.1908B3D7@home.com>
John Porter wrote:
>
> Why don't you post what you've got, and we'll take a look at it.
>
Alright here it is - forget about what it does. It doesn't do anything,
it's a pure experiment to see what a hash looks like after being passed
to a subroutine. The idea was to get a local copy of the hash that the
sub could play with while not perturbing the original (similar to C,C++
argument passing).
## In a file called test1.pl
use hashtest;
%hash = (
FirstLink => "http://localhost/index.html",
SecondLink => "http://www.sun.com",
);
hashtest->hashtest(%hash);
## end test1.pl
## in the file hashtest.pm
package hashtest;
sub hashtest {
shift(@_);
foreach $arg (@_) {
push(@hasharr,$arg);
$i++;
print "Arg $i :$arg\n";
}
# if you run this you will that there is only a plain array here. I
want the # *whole hash* as one of the arguments.
$i=0;
foreach $arg (@hasharr) {
print "Arg $i :$hasharr[$i]\n";
$i++;
}
print "$#hasharr\n";
$hashcmd = "\%localhash = (";
print "$hashcmd\n";
for ($i=0;$i<=1+$#hasharr;$i+=2) {
$value = pop(@hasharr);
$key = pop(@hasharr);
$hashcmd = join ('',$hashcmd,$key," => ","\"",$value,"\",\n\t\t");
print "$hashcmd\n";
}
$hashcmd = join('',$hashcmd,");");
print "$hashcmd\n";
eval $hashcmd;
print "$localhash{FirstLink}\n";
}
1;
## end hashtest.pm
--
------------------------------------------------------
| Visit my website at http://members.home.net/gregp/ |
| #include <sig.h> |
------------------------------------------------------
------------------------------
Date: Mon, 9 Mar 1998 22:08:07 -0500
From: eweiss@winchendon.com (Eric Weiss)
Subject: Re: PerlW32 on NT, cannot use > or | why?
Message-Id: <MPG.f6e78a626ea7e429896c0@news.dgsys.com>
I'm new to this question, but what does your hello.pl file
look like? I usually use something like:
c:\progra~1\perl\bin\perl hello.pl | more
which works fine for Windows 95. You may be having trouble
if your hello.pl is really a batch file.
Eric
------------------------------
Date: Tue, 10 Mar 1998 03:14:22 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: pty terminal control and IPC via pseudo-terminal devices
Message-Id: <EpL2By.1JI@world.std.com>
rollins@wfu.edu (Mike Rollins) writes:
>Does anyone know how to communicate with a child process via
>psuedo termianal devices in Perl?
Take a look at the Expect.pm module <URL:http://www.perl.com/CPAN/
modules/by-authors/Austin_Schutz/Expect.pm-1.01.tar.gz>
Or wait until the IO::Pty module becomes available. see
<URL:http://reference.perl.com/module.cgi?IO::Pty> for details.
--
Andrew Langmead
------------------------------
Date: 10 Mar 1998 03:28:02 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: RegEx for HTML...
Message-Id: <6e2c02$89e$1@client3.news.psi.net>
KUNAL KAPUR (slh6z@cc.usu.edu) wrote on 1651 September 1993 in
<URL: news:dZpqkDvyR5i2@cc.usu.edu>:
++ I am trying to write a regular expression to extract bold and italic
++ words from html files.
++
++ Sounds trivial, but I can't figure what I am doing wrong!
++
++ Could somebody please help!
You didn't use HTML::Parser;
Abigail
--
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle 'print +(HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET", "http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content)) =~ /(.*\))[-\s]+Additional/s) [0]'
------------------------------
Date: Mon, 09 Mar 1998 21:40:19 -0800
From: Michael Schilli <mschilli@blaxxun.com>
Subject: Since when is localtime(0) no longer 1970???
Message-Id: <3504D243.80167A@blaxxun.com>
While this used to be january 1st, 1970, localtime(0) is nowadays
(0 0 16 31 11 69 3 364 0)
Am I in a galactic wormhole? Help!
-- Michael
----------------------------------------------------------
Michael Schilli http://mission.base.com/mschilli
----------------------------------------------------------
------------------------------
Date: Mon, 9 Mar 1998 19:31:48 -0800
From: Nick Halloway <snowe@rain.org>
Subject: Speed of sort routine vs. one-by-one compare (123)
Message-Id: <Pine.SUN.3.96.980309192608.18282A-100000@coyote.rain.org>
Hello,
I need to keep a file sorted. It would have records added to it one
by one.
Which is quicker, using Perl's sort function to sort the whole file
plus one new record, or comparing the new record to each of the file's
records in turn to see where it goes?
The file might have several thousand records, maybe 50,000 or so.
Thanks.
------------------------------
Date: Mon, 09 Mar 1998 20:20:17 -0800
From: pwolf_REMOVE_THIS_TO_REPLY_@qualcomm.com (Paul Wolf)
Subject: Re: Speed of sort routine vs. one-by-one compare (123)
Message-Id: <pwolf_REMOVE_THIS_TO_REPLY_-0903982020170001@pwolf-mac.qualcomm.com>
I don't know how Perl's sort function is constructed, but your proposed
alternative is called an insertion sort, and a binary search to determine
where it should be placed is certainly faster that comparing it to each of
the file records.
In article <Pine.SUN.3.96.980309192608.18282A-100000@coyote.rain.org>,
Nick Halloway <snowe@rain.org> wrote:
> Hello,
> I need to keep a file sorted. It would have records added to it one
> by one.
>
> Which is quicker, using Perl's sort function to sort the whole file
> plus one new record, or comparing the new record to each of the file's
> records in turn to see where it goes?
>
> The file might have several thousand records, maybe 50,000 or so.
>
> Thanks.
------------------------------
Date: Mon, 9 Mar 1998 20:50:04 -0800
From: Nick Halloway <snowe@rain.org>
Subject: Re: Speed of sort routine vs. one-by-one compare (123)
Message-Id: <Pine.SUN.3.96.980309204332.23998A-100000@coyote.rain.org>
On Mon, 9 Mar 1998, Paul Wolf wrote:
> I don't know how Perl's sort function is constructed, but your proposed
> alternative is called an insertion sort, and a binary search to determine
> where it should be placed is certainly faster that comparing it to each of
> the file records.
Is there a binary insertion sort routine around?
I wonder if a bubble sort, that is comparing the record to each
record in turn, would take a long time with 50,000 records.
Longer than a second, say? It would be comparing records on
length of the first word.
------------------------------
Date: 10 Mar 1998 05:08:37 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Speed of sort routine vs. one-by-one compare (123)
Message-Id: <6e2hsl$9qv$2@client2.news.psi.net>
Nick Halloway (snowe@rain.org) wrote on 1652 September 1993 in
<URL: news:Pine.SUN.3.96.980309192608.18282A-100000@coyote.rain.org>:
++ Hello,
++ I need to keep a file sorted. It would have records added to it one
++ by one.
++
++ Which is quicker, using Perl's sort function to sort the whole file
++ plus one new record, or comparing the new record to each of the file's
++ records in turn to see where it goes?
That depends. If you need to have the file sorted between the additions,
inserting them one by one is faster. Such an insertion can be done in
linear time, while sorting will take Omega (n log n).
Now, if you can take all the records at once, an then sort your
file, sorting still takes O (n log n), but the one by one insertion
takes Omega (n ^ 2) time.
++ The file might have several thousand records, maybe 50,000 or so.
50,000 of how much data each? If you use perls sort, you need to
slurp in the entire file into memory, and that could mean lots and
lots of swapping. If your file is really, really huge, you might
prefer the system "sort" command.
Abigail
--
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'
------------------------------
Date: Mon, 9 Mar 1998 21:19:17 -0800
From: Nick Halloway <snowe@rain.org>
Subject: Re: Speed of sort routine vs. one-by-one compare (123)
Message-Id: <Pine.SUN.3.96.980309211528.26290A-100000@coyote.rain.org>
On 10 Mar 1998, Abigail wrote:
> Nick Halloway (snowe@rain.org) wrote on 1652 September 1993 in
> <URL: news:Pine.SUN.3.96.980309192608.18282A-100000@coyote.rain.org>:
> ++ Hello,
> ++ I need to keep a file sorted. It would have records added to it one
> ++ by one.
> ++
> ++ Which is quicker, using Perl's sort function to sort the whole file
> ++ plus one new record, or comparing the new record to each of the file's
> ++ records in turn to see where it goes?
>
> That depends. If you need to have the file sorted between the additions,
> inserting them one by one is faster.
Yes, it would be kept sorted, and each time a new record is added it
would be put into the right place. If anyone has a binary sort
routine to do this that would be plenty quick, I'm sure.
------------------------------
Date: Mon, 09 Mar 1998 23:48:03 -0500
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
Subject: Re: The -w switch (was Re: better way to do this?)
Message-Id: <3504C605.33E073ED@coos.dartmouth.edu>
Joseph N. Hall wrote:
>
> -w's tendency to spew hundreds or thousands of lines of messages
> is yet another indication it's still not ready for prime time.
> Just about every compiler I've ever used has had a message like
> "Too many errors. Compilation halted." However, -w has evolved in
> the direction of dogma rather than utility. In my humble opinion.
Of course, since many -w messages are runtime warnings, I don't see how the
comparison to a compiler is particularly useful. In particular, if you're
getting hundreds or thousands of warnings, they're probably being generated by
a loop during runtime.
In any case, they're called warnings because that's what they are; they are
specifically not errors, and so there's no need to halt compilation just
because you get several of them.
--
_ / ' _ / - 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."
------------------------------
Date: Mon, 09 Mar 1998 22:18:28 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: The -w switch (was Re: better way to do this?)
Message-Id: <3504CCAC.778E5E04@5sigma.com>
Okay, whatever.
-joseph
Ronald J Kimball wrote:
> Of course, since many -w messages are runtime warnings, I don't see how the
> comparison to a compiler is particularly useful.
--
Joseph N. Hall, prop., 5 Sigma Productions mailto:joseph@5sigma.com
Author, Effective Perl Programming . . . . . http://www.effectiveperl.com
Perl Training . . . . . . . . . . . . . . . http://www.perltraining.com
Omniscient trash / Mr. Con Antithesis / In shortest, manic!
------------------------------
Date: 10 Mar 1998 03:51:54 GMT
From: bem@news.cmc.net (brian moore)
Subject: Re: Tom, grow up [Re: The -w switch (was Re: better way to do this?)]
Message-Id: <slrn6g9e6p.o8b.bem@thorin.cmc.net>
On 9 Mar 1998 15:46:57 GMT,
Tom Christiansen <tchrist@mox.perl.com> wrote:
> [courtesy cc of this posting sent to cited author via email]
>
>In comp.lang.perl.misc, "Eric D. Friedman" <friedman@uci.edu> writes:
>:Amazingly, the charter openly acknowledges that TPI
>:may have a commercial interest in making such announcements,
>
>No. TPI is not a commerical enterprise. It is not for profit,
>dedicated to keeping Perl free and available.
>
>--to
^-- now you're gonna hafta explain the lack of an m.
Is it anti-Microsoft? Telling us, in effect, to drop the M from our
lives?
Or is it that we should use the m to mark clp.moderated?
Or is it that we should not use money as our sole motivator in promoting
Perl, getting the m of moolah, money, and mammon from our lives (this
may be related to the Microsoft theory as well).
Or is it not the lack of an m at all, but the presence of 'to': that
your posts give us a direction to go forward, a destination.
Enquiring minds want to know.
------------------------------
Date: Tue, 10 Mar 1998 03:23:50 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: using a scalar in an expression
Message-Id: <EpL2rq.6su@world.std.com>
farber@f-tech.net (Paul Farber) writes:
>if ($_ =~ /$month/ )
> { print $_;}
>It works fine if I enter /Dec/, it prints out all lines with Dec in
>it, but it willnot work using the scalar, camel book isn't down on my
>level, as I am new to perl.
As long as $month contains "Dec", it should do as you want. Are you
sure this is the case? You might want to check with the debugger to
make sure.
Are you sure the the code sets the scalar $month? (No typos, no
varying capitization, and no way that the flow of your program skips
the initialization.)
Are you sure that $month contains exactly what you expect? (no leading
or trailing whitespace. No newlines that need to be chomp()ed. The
case of the letters is what you think it should be.)
--
Andrew Langmead
------------------------------
Date: 10 Mar 1998 03:01:32 GMT
From: "Eric D. Friedman" <friedman@uci.edu>
Subject: Re: using a scalar in an expression
Message-Id: <6e2aec$687@news.service.uci.edu>
In article <35049fd6.30524954@news.f-tech.net>,
Paul Farber <farber@f-tech.net> wrote:
<I'm stumped, im trying to print out a line if it conatians the month,
<the lines in question are:
<
<if ($_ =~ /$month/ )
< { print $_;}
<
<It works fine if I enter /Dec/, it prints out all lines with Dec in
<it, but it willnot work using the scalar, camel book isn't down on my
<level, as I am new to perl.
I'd love to help you but I don't understand what you're asking. What
do you mean by "using the scalar?" :-(
--
Eric D. Friedman
friedman@uci.edu
------------------------------
Date: Mon, 09 Mar 1998 19:48:37 -0800
From: Franco Finstad <ffinstad@best.com>
Subject: Using regex to initial cap a name
Message-Id: <3504B813.BA50CA20@best.com>
I need to translate the string:
lastname, firstname
into:
Lastname, Firstname
I know this can be done elegantly using tr///; and s///; but I haven't
found a way.
Any ideas????
Thanks
Franco Finstad
------------------------------
Date: Tue, 10 Mar 1998 04:08:38 GMT
From: Eric Wong <egwong@netcom.com>
Subject: Re: Using regex to initial cap a name
Message-Id: <egwongEpL4uE.B5v@netcom.com>
Franco Finstad <ffinstad@best.com> wrote:
: I need to translate the string:
: lastname, firstname
: into:
: Lastname, Firstname
: I know this can be done elegantly using tr///; and s///; but I haven't
: found a way.
How about
s/(\w+)/\u$1/g;
[ cc'd ]
------------------------------
Date: 10 Mar 1998 03:53:56 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Using regex to initial cap a name
Message-Id: <6e2dgk$18n$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
ffinstad@best.com writes:
:I need to translate the string:
: lastname, firstname
:into:
: Lastname, Firstname
:
:I know this can be done elegantly using tr///; and s///; but I haven't
:found a way. Any ideas????
Yup, here's one:
% man perlfaq4
[...]
How do I capitalize all the words on one line?
--tom
--
Tom Christiansen tchrist@jhereg.perl.com
"The usability of a computer language is inversely proportional to the
number of theoretical axes the language designer tries to grind."
--Larry Wall
------------------------------
Date: 10 Mar 1998 05:03:16 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Using regex to initial cap a name
Message-Id: <6e2hik$9qv$1@client2.news.psi.net>
Franco Finstad (ffinstad@best.com) wrote on 1652 September 1993 in
<URL: news:3504B813.BA50CA20@best.com>:
++ I need to translate the string:
++
++ lastname, firstname
++
++ into:
++
++ Lastname, Firstname
++
++ I know this can be done elegantly using tr///; and s///; but I haven't
++ found a way.
I suggest:
tr/firstname/perlfaq 4/;
HTH. HAND.
Abigail
--
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle 'print +(HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET", "http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content)) =~ /(.*\))[-\s]+Additional/s) [0]'
------------------------------
Date: Mon, 9 Mar 1998 22:22:11 -0500
From: eweiss@winchendon.com (Eric Weiss)
Subject: Re: Why I have a result such as 108.879999999999
Message-Id: <MPG.f6e7bf1ef4823d9896c1@news.dgsys.com>
[This followup was posted to comp.lang.perl.misc and a copy was sent to
the cited author.]
Quote:
Subject: Why I have a result such as 108.879999999999
From: Fu Zhibin <ff@public.fz.fj.cn>
Newsgroups: comp.lang.perl.misc
Hi all:
in my program:$fee=360+0.12*int(($time-$timebase)/60)
So,int(($time-$timebase)/60)is an integer.
but why $fee is result as xxx.xx99999999....(It should be xxx.xx+0.01)
Or the result is xxx.xx00000000...1 (so it should be xxx.xx)
Why it happen??Should I do some config to the variables??
But how?or it is because the "int" ??
Appreciated to any help
regards
ff@public.fz.fj.cn
First, all floating point calculations are approximate since a binary
computer cannot in general store a decimal (floating point) number
exactly. So you could well be better off droppping the 'int' if that
is appropriate. Second, if you want a specific output format, use
printf which allows you to use a specific format such as %8.2f
Eric
eweiss@winchendon.com
------------------------------
Date: Mon, 9 Mar 1998 22:03:00 -0600
From: "Jack Lavender" <jackal@fastlane.net>
Subject: Re: Win32 help request, rename problem
Message-Id: <6e2e38$8vo@news.cybernews.net>
Dave,
Thanks for the suggestion.
That works for the stand alone run. Running from Personal Web Server still
fails?
>
>In the Win32 world the rename is the same as move and move
>fails if there already exists a file with the same name as
>the new file name you are specifying.
>Have you tried to check for an existing file and delete
>(unlink) it if it does exist:
> unlink( $lock_file ) if ( -e $lock_file);
>
>dave
------------------------------
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 2061
**************************************