[16545] in Perl-Users-Digest
Perl-Users Digest, Issue: 3957 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 9 00:05:27 2000
Date: Tue, 8 Aug 2000 21:05:12 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <965793911-v9-i3957@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 8 Aug 2000 Volume: 9 Number: 3957
Today's topics:
Re: - Free ebooks and resources - <lbalakamatchi@selectica.com>
Re: - Free ebooks and resources - <jeff@vpservices.com>
Re: - Free ebooks and resources - <technews@NOSPAMns.sympatico.ca>
Re: - Free ebooks and resources - <mauldin@netstorm.net>
??? vagabond_nomad@my-deja.com
ANNOUNCE: Quantum::Superpositions 1.00 (Damian Conway)
CGI / Pearl Interfacing w/ Dos Program Question vagabond_nomad@my-deja.com
Re: CGI.PM How to get all Form's value in a HashTable? (Keith Calvert Ivey)
Re: CGI.PM How to get all Form's value in a HashTable? (brian d foy)
Re: CGI.pm not passing ampersands properly (Keith Calvert Ivey)
CGI/Pearl Interfacing w/ DOS Program Question vagabond_nomad@my-deja.com
Re: Converting from US dates/numbers to European dates/ (Keith Calvert Ivey)
Re: Converting from US dates/numbers to European dates/ (Keith Calvert Ivey)
Re: Converting from US dates/numbers to European dates/ <waltman@netaxs.com>
Re: Difference between a .cgi file and a .pl file? (Tim Hammerquist)
Re: Difference between a .cgi file and a .pl file? (brian d foy)
Re: Difference between a .cgi file and a .pl file? (brian d foy)
Re: Executing Unix commads on a IIS request (David Efflandt)
Re: is mysql faster using Perl or PHP? (brian d foy)
Japanese EUC/SJIS format text alignment <eric@activesw.com>
Modules and Webservers (BUCK NAKED1)
Re: Parsing name list -- Help! <jeff@yoak.com>
Re: Parsing name list -- Help! <jeff@yoak.com>
Re: perl sql (delimited) <jeff@vpservices.com>
Re: Pop Ups (BUCK NAKED1)
Re: Pop Ups <tony_curtis32@yahoo.com>
Regular expression to check for non-alphanumeric? <studentfl@hotmail.com>
Re: Regular expression to check for non-alphanumeric? <troyr@vicnet.net.au>
Re: Tk module for Windows NT dcumro@my-deja.com
Re: Upgrade 5.004 -> 5.6 and binary modules <dan@tuatha.sidhe.org>
Re: When does it pay to presize an array? <dan@tuatha.sidhe.org>
Re: When does it pay to presize an array? <dan@tuatha.sidhe.org>
Re: When does it pay to presize an array? (Andrew J. Perrin)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 08 Aug 2000 17:50:32 -0700
From: Balakamatchi Loganathan <lbalakamatchi@selectica.com>
Subject: Re: - Free ebooks and resources -
Message-Id: <3990AAD8.6852CBF3@selectica.com>
Check at www.FreeOnlineBooks.com and www.InformIT.com. You could find lot of
free ebooks. Also try to refer at www.redbooks.ibm.com , where you get more
redbooks for IBM and Java related stuff
COM Service wrote:
> I would like to know where I can find free ebooks and good resources about
> Java, Perl, Unix, ASP and Visual Basic. Contact me at:
> mailto:webmaster@brokerpal.com Thanks in advance.
> Regards, Dejan
> Editor of Broker Pal - Free list of expired domain names, domain news,
> auction, web design, Internet marketing and web programming.
> Subscribe: mailto:bizi-subscribe@listbot.com
------------------------------
Date: Tue, 08 Aug 2000 19:41:16 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: - Free ebooks and resources -
Message-Id: <3990C4CC.43E72058@vpservices.com>
Balakamatchi Loganathan wrote:
>
> Check at www.FreeOnlineBooks.com
Does anyone other than me sense two oxymorons in that one URL?
--
Jeff
------------------------------
Date: Wed, 09 Aug 2000 02:49:25 GMT
From: Cannon Fodder <technews@NOSPAMns.sympatico.ca>
Subject: Re: - Free ebooks and resources -
Message-Id: <Pine.LNX.4.04.10008082259540.24565-100000@snoopy.peanuts>
www.ibooks.com
On Tue, 8 Aug 2000, COM Service wrote:
> I would like to know where I can find free ebooks and good resources about
> Java, Perl, Unix, ASP and Visual Basic. Contact me at:
> mailto:webmaster@brokerpal.com Thanks in advance.
> Regards, Dejan
> Editor of Broker Pal - Free list of expired domain names, domain news,
> auction, web design, Internet marketing and web programming.
> Subscribe: mailto:bizi-subscribe@listbot.com
>
>
>
>
------------------------------
Date: Wed, 09 Aug 2000 02:55:58 GMT
From: Jim Mauldin <mauldin@netstorm.net>
Subject: Re: - Free ebooks and resources -
Message-Id: <3990C7A8.F4454391@netstorm.net>
Jeff Zucker wrote:
>
> Balakamatchi Loganathan wrote:
> >
> > Check at www.FreeOnlineBooks.com
>
> Does anyone other than me sense two oxymorons in that one URL?
>
Funny! What gets me is that Bill Gates says he can't read more than
three pages on the Web, but he's threatening to take my newspaper away
(a bit of hyperbole, but scary nonetheless).
-- Jim
------------------------------
Date: Wed, 09 Aug 2000 01:15:40 GMT
From: vagabond_nomad@my-deja.com
Subject: ???
Message-Id: <8mqbbr$q30$1@nnrp1.deja.com>
Why aren't any of my messages appearing?
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 9 Aug 2000 01:08:17 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: ANNOUNCE: Quantum::Superpositions 1.00
Message-Id: <sp1ge38o63a52@corp.supernews.com>
Keywords: perl, module, release
==============================================================================
Release of version 1.00 of Quantum::Superpositions
==============================================================================
NAME
Quantum::Superpositions - QM-like superpositions for Perl
DESCRIPTION
The Quantum::Superpositions module provides a new scalar data
structure: the superposition. In a metaphor drawn from quantum
mechanics, superpositions store a collection of values by overlaying
them in parallel superimposed states within a single scalar
variable. Which allows for cool stuff like:
use Quantum::Superpositions;
if ($x eq any($a, $b, $c) { ... }
while ($nextval < all(@thresholds) { ... }
$max = any(@value) < all(@values);
AUTHOR
Damian Conway (damian@conway.org)
COPYRIGHT
Copyright (c) 1997-2000, Damian Conway. All Rights Reserved. This module
is free software. It may be used, redistributed and/or modified under
the terms of the Perl Artistic License (see
http://www.perl.com/perl/misc/Artistic.html)
==============================================================================
CHANGES IN VERSION 1.00
(No changes have been documented for this version)
==============================================================================
AVAILABILITY
Quantum::Superpositions has been uploaded to the CPAN
and is also available from:
http://www.csse.monash.edu.au/~damian/CPAN/Quantum-Superpositions.tar.gz
==============================================================================
------------------------------
Date: Wed, 09 Aug 2000 00:58:58 GMT
From: vagabond_nomad@my-deja.com
Subject: CGI / Pearl Interfacing w/ Dos Program Question
Message-Id: <8mqaci$pck$1@nnrp1.deja.com>
I am very, very, very new to CGI / Pearl, so I apologize in advance for my
vast ignorance on this subject. My task is to find a way interface a CGI
program with a DOS program sitting on a UNIX server. Here are the specifics:
From a web browser, a user will start up a DOS program sitting on a UNIX
server. The DOS program will send output to the user's web browser that will
be displayed as HTML. The user will then enter some input into the web
browser, which will then be sent back to the DOS program for processing. Next
the DOS program will send output, based on the user's last input, back to the
user's web browser. And so on.
Is this possible? If so, can someone help me understand how to do this?
Code examples would be greatly appreciated since I don't really understand
much about Pearl yet. Again, I'd be tremendously thankful if someone could
help solve this problem, or perhaps point me to a site where I might be able
to get some help.
-Brent
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 09 Aug 2000 00:52:48 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: CGI.PM How to get all Form's value in a HashTable?
Message-Id: <3993aa4d.3417760@news.newsguy.com>
nobull@mail.com wrote:
>kcivey@cpcug.org (Keith Calvert Ivey) writes:
>> Unfortunately, the POD that comes with CGI.pm is not as good as
>> the documentation at http://stein.cshl.org/WWW/CGI/. Vars() is
>> indeed part of CGI.pm, and it returns a hash when called in
>> array context (and a tied hash reference when called ina cslar
>> conference).
I canceled this post and posted a correction, but since you've
quoted it I wanted to point out that I was wrong here. The
documentation does say that Vars() returns a hash in list
context. It's only in scalar context that it returns a tied
hash reference.
>I was using an older version of CGI.pm (egg on face). I still think
>Vars() is an unusual name for a method.
It is strange. I guess it's capitalized because of the vars
pragma, though that's not quite the same as capitalizing Tr()
to avoid a clash with tr///.
--
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC
------------------------------
Date: Tue, 08 Aug 2000 22:09:09 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: CGI.PM How to get all Form's value in a HashTable?
Message-Id: <brian-ya02408000R0808002209090001@news.panix.com>
In article <Pine.GHP.4.21.0008081221010.20544-100000@hpplus03.cern.ch>, "Alan J. Flavell" <flavell@mail.cern.ch> posted:
> On Tue, 8 Aug 2000, brian d foy wrote:
> > > Unfortunately, the POD that comes with CGI.pm is not as good as
> > > the documentation at http://stein.cshl.org/WWW/CGI/.
> > it's the same stuff, adjusted for version differences.
> You are mistaken, I'm afraid. I fell into that trap too, until
> Lincoln Stein pointed out the problem to me. He maintains the HTML
> version carefully, whereas the POD documentation, even in the newer
> releases which I was discussing with him, contained quite a number of
> pieces of obsolete and by-now misleading stuff.
are you saying that there are two different branches of documentation,
or that the CGI.pm docs at that URL are updated more frequently?
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Mongers <URL:http://www.perl.org/>
------------------------------
Date: Wed, 09 Aug 2000 00:36:36 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: CGI.pm not passing ampersands properly
Message-Id: <3990a545.2130243@news.newsguy.com>
Albert Dewey <timewarp@shentel.net> wrote:
>If you are depending on the info from a text box in an html form you might use
>a little javascript error checking in your page to convert characters like the
>ampersand to %26 before it gets posted and then decode it with your perl script
>once the server receives it. This will prevent accidental parsing of your data
>by your script at the '&' position in the text data.
Of course then your browser will escape the data when posting
it, and the '%26' will get changed to '%2526', unless of course
JavaScript is disabled, in which case you'll still get '%26'
(since the browser escapes the '&' in the data anyway when it
post it). And then when your script receives the data it'll
have to decide somehow whether to decode once or twice. And the
purpose of all this is what? If your browser is sending '&' in
the data without escaping it, then there's something seriously
wrong with your browser.
Of course, this has nothing to do with Perl, and I doubt the
people in comp.infosystems.www.authoring.cgi will appreciate it
either.
--
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC
------------------------------
Date: Wed, 09 Aug 2000 01:01:08 GMT
From: vagabond_nomad@my-deja.com
Subject: CGI/Pearl Interfacing w/ DOS Program Question
Message-Id: <8mqagj$plm$1@nnrp1.deja.com>
I am very, very, very new to CGI / Pearl, so I apologize in advance for
my vast ignorance on this subject. My task is to find a way interface a
CGI program with a DOS program sitting on a UNIX server. Here are the
specifics:
From a web browser, a user will start up a DOS program sitting on a UNIX
server. The DOS program will send output to the user's web browser that
will be displayed as HTML. The user will then enter some input into the
web browser, which will then be sent back to the DOS program for
processing. Next the DOS program will send output, based on the user's
last input, back to the user's web browser. And so on.
Is this possible? If so, can someone help me understand how to do this?
Code examples would be greatly appreciated since I don't really
understand much about Pearl yet. Again, I'd be tremendously thankful if
someone could help solve this problem, or perhaps point me to a site
where I might be able to get some help.
-Brent
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 09 Aug 2000 01:10:25 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: Converting from US dates/numbers to European dates/numbers
Message-Id: <3994ae5b.4456622@news.newsguy.com>
Walt Mankowski <waltman@netaxs.com> wrote:
>Locales allow a
>programmer in the US to write
>
>$pi = 3.14159
>
>and a programmer in France to write
>
>$pi = 3,14159
I have no experience with locales, but that's not what
perllocale says. What would the French programmer use
for a comma operator, then?
--
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC
------------------------------
Date: Wed, 09 Aug 2000 01:18:12 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: Converting from US dates/numbers to European dates/numbers
Message-Id: <3995afce.4827424@news.newsguy.com>
"Alan J. Flavell" <flavell@mail.cern.ch> wrote:
>On Tue, 8 Aug 2000, Jürgen Exner wrote:
>
>> The vast majority of countries in particular in Europe uses a decimal comma
>> instead of a decimal point. Japan (and some other FE countries) follow the
>> US, there you are right.
>
>Maybe it's that the US follows Britain. But I would say that,
>wouldn't I.
But regardless of who's following, we both use the more
sensible decimal separator. With decimal commas, you have
to use semicolons for a simple list of numbers. Of course,
we shouldn't be using either commas or periods for thousand
separators, but those come up less often -- I suppose the
people who use ' (the Dutch?) are the most sensible there
(though the thin space and our beloved underscore are also
possibilities).
>Pity they can't get a sensible date format, though.
Yours is just less unsensible than ours. Not many people use
the sensible one.
--
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC
------------------------------
Date: 08 Aug 2000 23:25:53 -0400
From: Walt Mankowski <waltman@netaxs.com>
Subject: Re: Converting from US dates/numbers to European dates/numbers
Message-Id: <m33dkf9ku6.fsf@netaxs.com>
kcivey@cpcug.org (Keith Calvert Ivey) writes:
> Walt Mankowski <waltman@netaxs.com> wrote:
>
> >Locales allow a
> >programmer in the US to write
> >
> >$pi = 3.14159
> >
> >and a programmer in France to write
> >
> >$pi = 3,14159
>
> I have no experience with locales, but that's not what
> perllocale says. What would the French programmer use
> for a comma operator, then?
DOH! You're right. Sorry about that. Perl, of course, thinks that
the comma is an operator. It does work if you say
$pi = "3,14159"
because Perl will convert the string into a floating point.
------------------------------
Date: Wed, 09 Aug 2000 01:03:33 GMT
From: tim@degree.ath.cx (Tim Hammerquist)
Subject: Re: Difference between a .cgi file and a .pl file?
Message-Id: <slrn8p1c27.u2.tim@degree.ath.cx>
On 07 Aug 2000 15:33:34 GMT, Abigail <abigail@foad.org> wrote:
> Tim Hammerquist wrote:
> [] This is correct for the most part. However, .pl (by def) implies that
> [] it's a perl script, perl library, or something written in Polish. =)
>
> By whose definition?
The perl docs mentioned that .pl was an old extension for perl
"libraries," such as cgi-lib.pl, which isn't an independent script, but
a "library" of functions, etc.
ActivePerl for Win32, which operates far too much by file extension,
maps .pl to perl.exe by default.
As for Polish, check your locale dir(s) on *nix systems.
Maybe I should have clarified: .pl IMPLIES perl script by CONVENTION.
It doesn't mean I agree or endorse this practice.
> [] In the end, these are mostly semantic differences. If you see an
> [] executable with a .cgi extension, it's most likely written in perl.
>
> I could easily make PNG images with a .cgi extension, and instruct a web
> server to execute files with a .html extension.
Very true. Then again, most files you see with a .cgi extension
_aren't_ PNG images.
For future reference, I might not always post my personal belief,
preference, or endorsed practice. I might make reference to obsolete
methods, or maybe just what "some people" do.
--
-Tim Hammerquist <timmy@cpan.org>
Of course, that's just my opinion. I could be wrong.
-- Dennis Miller
------------------------------
Date: Tue, 08 Aug 2000 22:04:30 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: Difference between a .cgi file and a .pl file?
Message-Id: <brian-ya02408000R0808002204300001@news.panix.com>
In article <3990902e$1_1@news.nwlink.com>, "Jack Thomas" <jthomas@pdxgothic.com> posted:
> I think your all missing the point of my reply to the person who asked the
> question originally.
> My answer was SPECIFIC to Perl .pl and Perl .cgi files.
and you miss our point - file extensions are meaningless without
context. even in a Perl context, not all file extensions are
magic.
> You must of course keep in mind, that it really depends on the MIME type
> mapping on the server as well.
perhaps, but not necessarily. there are other things that can affect
this as well.
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Mongers <URL:http://www.perl.org/>
------------------------------
Date: Tue, 08 Aug 2000 22:06:17 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: Difference between a .cgi file and a .pl file?
Message-Id: <brian-ya02408000R0808002206170001@news.panix.com>
In article <slrn8p1c27.u2.tim@degree.ath.cx>, tim@degree.ath.cx (Tim Hammerquist) posted:
> Very true. Then again, most files you see with a .cgi extension
> _aren't_ PNG images.
and most *URLs* with a .cgi extension are not Perl source. ;)
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Mongers <URL:http://www.perl.org/>
------------------------------
Date: Wed, 9 Aug 2000 01:08:43 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Executing Unix commads on a IIS request
Message-Id: <slrn8p1boo.3ek.efflandt@efflandt.xnet.com>
On Tue, 08 Aug 2000, pularis@my-deja.com <pularis@my-deja.com> wrote:
> I am running IIS on NT server 4.0.As an enhancement to the server I
>want to add the functioanlity of being able to execute commands on a
>unix host ( running Solaris ) and somehow magically get the output back
>to the IIS/NT server and display the result as an HTML page. The idea
>being able to provide a web based interface to execute commads on a unix
>host. All n every help will be deeply appreciated. Thanks a much
Does Net::Telnet work on NT? Maybe you could set up a restricted user on
the Unix box for that.
--
David Efflandt efflandt@xnet.com http://www.de-srv.com/
http://www.autox.chicago.il.us/ http://www.berniesfloral.net/
http://hammer.prohosting.com/~cgi-wiz/ http://cgi-help.virtualave.net/
------------------------------
Date: Tue, 08 Aug 2000 22:11:46 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: is mysql faster using Perl or PHP?
Message-Id: <brian-ya02408000R0808002211460001@news.panix.com>
In article <8mq4l8$lu4$1@nnrp1.deja.com>, hamed53@my-deja.com posted:
> > perhaps you can elaborate. you don't seem to know anything about
> > PHP, Perl, or MySQL, so it's dubious that you could the grounds
> > for such a claim.
> From reading your comments on Kris's comment, it seems you claim that
> you may have a wider knowledge on Perl, PHP or MySQL...
> Now, what is your reply to "my" (original) message? What is your idea?
> is database connectivity with MySQL is faster in Perl or PHP?
i don't even know what you are doing, or that it even matters in
your situation. i don't have an answer for you. it's not something
that has one answer, and it's not an interesting enough question for
me to pursue. perhaps you should prototype your system using each
and then benchmark them.
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Mongers <URL:http://www.perl.org/>
------------------------------
Date: 09 Aug 2000 01:16:09 GMT
From: Eric van Bezooijen <eric@activesw.com>
Subject: Japanese EUC/SJIS format text alignment
Message-Id: <3990B0D9.9A76A770@activesw.com>
I'm trying to use perl to display strings in Japanese. I'm using perl
5.6 and have to use native EUC and SJIS encodings. I've gotten
everything to look pretty clean put my format lines aren't lining up.
As soon as I have a japanese bit of text in a format write all the
columns stop lining up probably because the width of the characters is
so random.
Converting to UTF8 and using jperl are not options for me.
Is there a simple solution for this ?
-Eric
--
Eric van Bezooijen eric@activesw.com
http://www.activesw.com/~eric
"But the meaning of life is a mystery, that we don't understand so far.
And the music of life is a rhapsody if you're happy the way that you
are."
-"Freudiana"<P><IMG
SRC="http://www.activesw.com/~eric/images/eric.gif">
------------------------------
Date: Tue, 8 Aug 2000 20:10:29 -0500 (CDT)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Modules and Webservers
Message-Id: <19462-3990AF85-86@storefull-245.iap.bryant.webtv.net>
How do I install a perl module that isn't located on my website's
server? I use Prohosting.com(Unix Apache), and many times they don't
have the module that I need. I probably don't have access to their root
directory, but from the research that I've done, I understand that you
can install a module in any website directory that the script is in, and
it will work.
I have already searched and read about this subject, including CPAN's
"How to Install a Module", but still cannot understand how. Could
someone please tell me how to do this in thorough and simple terms? An
example would be a plus.
Thank you.
Dennis
------------------------------
Date: Tue, 08 Aug 2000 19:34:56 -0800
From: "Jeff Yoak" <jeff@yoak.com>
Subject: Re: Parsing name list -- Help!
Message-Id: <8mq92d013e6@news1.newsguy.com>
[posted and emailed]
In article <8mpmau$l9i$1@news.fas.harvard.edu>, Tarun Ramadorai
<tramador@fas.harvard.edu> wrote:
> I'm just learning how to be a perl hacker, and I have the following
> problem:
You've presented a moderately tough one, but welcome to the community.
> I'm trying to write a Perl script which will parse this sort of list, in
> such a way that if any adjacent names on the list differ by N
> characters or less, then it prints OUT the first one instead of the
> misspelled one. For e.g., the above list now looks like:
Someone else pointed out that this is probably not what you really want to
do. And figuring out what I've written might be as hard as solving the
problem. And someone may have offered a simpler solution by now. And you
weren't specific about what should be printed in this case:
BERRY BARRY BARY
(When we scan BARRY we will skip it, leaving BERRY in the list and then
when we hit BARY, should it make the list though it is only one character
different from BARRY? Should we retrospectively put BARRY in? You
see...)
But it was fun, so here it is: # Comments encouraged
#!/usr/bin/perl
use strict;
use IO::File;
use Algorithm::Diff qw/diff/;
my $diff = shift || 1;
my @seen;
my $fh = new IO::File;
$fh->open("foo.txt") or die "open $!";
LINE: while (defined (my $line = $fh->getline())){
chomp $line;
my @part = split //, $line;
foreach my $seen (@seen){
my %spot;
map {$spot{$$_[1]}=()} (map {@$_} @{diff(\@part,$seen)});
if((keys %spot)<=$diff){
next LINE;
}
}
push @seen, \@part;
}
$fh->close();
foreach my $seen (@seen){
print join ("",@$seen),"\n";
}
------------------------------
Date: Tue, 08 Aug 2000 19:40:46 -0800
From: "Jeff Yoak" <jeff@yoak.com>
Subject: Re: Parsing name list -- Help!
Message-Id: <8mq9db013ns@news1.newsguy.com>
[posted and emailed]
In article <8mpmau$l9i$1@news.fas.harvard.edu>, Tarun Ramadorai
<tramador@fas.harvard.edu> wrote:
> I'm trying to write a Perl script which will parse this sort of list, in
> such a way that if any adjacent names on the list differ by N
> characters or less, then it prints OUT the first one instead of the
> misspelled one. For e.g., the above list now looks like:
>
> MCDONALD'S MCDONALD'S MCDONALD'S
CRAP! I was so pleased with myself too. :-) Ah, well. Once you
grasp what the program in my other post does, it should be easy to change
it so @seen keeps replacements of the skipped string so that you don't
just eliminate them.
Cheers,
Jeff
------------------------------
Date: Tue, 08 Aug 2000 18:18:13 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: perl sql (delimited)
Message-Id: <3990B155.338B9D9D@vpservices.com>
Jeff Zucker wrote:
>
> fg19537@my-deja.com wrote:
> >
> > Can anyone tell me how to create a pipe delimited file using SQL in
> > perl?
> > #!/home/tools/bin/perl -w
> > use DBI;
> > $dbh = DBI->connect("DBI:Informix:pro");
>
> The Informix driver is for the Informix database.
Oops, sorry, first time through I did not see that you are pulling data
out of Informix and constructing the pipe file from it. You can do that
in two steps (one step when I get the dang "convert" method done) like
so (put in Informix where I have mysql below):
#!perl -w
use strict;
use DBI;
my $dbh_ram = DBI->connect('dbi:RAM:','','',{RaiseError=>1});
my $dbh_mysql = DBI->connect('dbi:mysql:test','','',{RaiseError=>1});
my $sth_mysql = $dbh_mysql->prepare("SELECT fname, lname FROM names");
$sth_mysql->execute;
$dbh_ram->func({ # IMPORT FROM MySQL or Informix,
etc.
data_type => 'DBI',
data_source => $sth_mysql,
},'import' );
$dbh_mysql->disconnect;
$dbh_ram->func({ # EXPORT TO "Pipe Delimited"
data_target => 'test1.pipe',
data_type => 'PIPE',
data_source => 'SELECT * FROM table1',
},'export' );
__END__
Of course, just fixing your trimming mechanism like Bob Walton suggested
might be easier in the short run.
Jeff
--
perl -MDBI -e "$d=DBI->connect('dbi:RAM:');
$d->func(['Just,Another,Perl,Hacker'],'import');
print join ' ',$d->selectrow_array('SELECT * FROM table1')"
------------------------------
Date: Tue, 8 Aug 2000 19:51:08 -0500 (CDT)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Re: Pop Ups
Message-Id: <19463-3990AAFC-42@storefull-245.iap.bryant.webtv.net>
I think I understand what you're asking. Though a pop-up window alert
(with or without confirms) is usually done with javascript, there are
occasions when I also want perl to do it. Is Perl capable of doing
something similar to the JS version of alert('Message Goes Here'); ?
Anyone?
Regards,
DENNIS
------------------------------
Date: 08 Aug 2000 20:19:41 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Pop Ups
Message-Id: <87u2cv8c42.fsf@limey.hpcc.uh.edu>
>> On Tue, 8 Aug 2000 19:51:08 -0500 (CDT),
>> dennis100@webtv.net (BUCK NAKED1) said:
> I think I understand what you're asking. Though a pop-up
> window alert (with or without confirms) is usually done
> with javascript, there are occasions when I also want
> perl to do it. Is Perl capable of doing something
> similar to the JS version of alert('Message Goes Here');
>?
No, perl is server-side. It does not run in the browser.
hth
t
--
"With $10,000, we'd be millionaires!"
Homer Simpson
------------------------------
Date: Wed, 09 Aug 2000 01:21:12 GMT
From: "Robert Brooks" <studentfl@hotmail.com>
Subject: Regular expression to check for non-alphanumeric?
Message-Id: <cm2k5.31328$eS6.644697@news1.rdc1.md.home.com>
Need a little help here. I couldn't find this answer in any of my perl
books, so I am posting it here in hope of some help.
I need a regular expression that will allow me to set up a if statement that
goes like:
if this string contains something other then alphanumeric characters,
periods, or commas do this
Can't quite figure it out. Thanks folks.
------------------------------
Date: Wed, 9 Aug 2000 12:19:10 +1000
From: "Troy Rasiah" <troyr@vicnet.net.au>
Subject: Re: Regular expression to check for non-alphanumeric?
Message-Id: <ke3k5.79791$N4.2008046@ozemail.com.au>
if ($variablename=~/\W+/) {
print "there is an alphanumeric character in the string";
}
Unfortunately that won't let commas or dots thru either....so you'll have to
modify it a bit
--
----------------------------------------------------------------------------
----------------
Troy Rasiah
Database/Web Developer
Vicnet
troyr@vicnet.net.au
----------------------------------------------------------------------------
----------------
"Robert Brooks" <studentfl@hotmail.com> wrote in message
news:cm2k5.31328$eS6.644697@news1.rdc1.md.home.com...
> Need a little help here. I couldn't find this answer in any of my perl
> books, so I am posting it here in hope of some help.
>
> I need a regular expression that will allow me to set up a if statement
that
> goes like:
>
> if this string contains something other then alphanumeric characters,
> periods, or commas do this
>
> Can't quite figure it out. Thanks folks.
>
>
------------------------------
Date: Wed, 09 Aug 2000 03:03:12 GMT
From: dcumro@my-deja.com
Subject: Re: Tk module for Windows NT
Message-Id: <8mqhlf$ttf$1@nnrp1.deja.com>
In article <OZhj5.80$DT4.2755694@nnrp2.clara.net>,
newsgroups@ckeith.clara.net (Colin Keith) wrote:
> In article <8mg8hr$3or$0@216.39.131.175>,
homer.simpson@springfield.nul (Homer Simpson) wrote:
> >junk after document element at line 1, column 63, byte 63 at
> >C:/Perl/site/lib/XML/Parser.pm line 168
> >C:\>
>
> Hmmm, looks like the XML page you're getting is broken.
> Try getting it from a different site?
>
> set repository NAME URL
>
> Otherwise if PPM still doesn't work, the activestate docs say you can
get it
> from them in zip format:
>
> http://www.activestate.com/packages/zips
>
> hope it helps.
>
> Col.
>
> Damn, my bug's wandered off. I think its trying to steal my coke
bottle :p
>
> ---
> Colin Keith
> Systems Administrator
> Network Operations Team
> ClaraNET (UK) Ltd. NOC
>
Hi
I also got the error message "just after document element ..." from PPM
when trying to install libnet. I noticed that the activestate website
changed its directories. What used to be www.activestate.com/packages/
is now www.activestate.com/PPMPakages/5.005/. First I tried just "PPM>
set repository activestate
http://www.activestate.com/PPMPackages/5.005/". That didn't solve my
problem. I then looked at ppm.xml and noted that it had a lot of
references to www.activestate.com/packages. So I made a backup copy of
ppm.xml and then did a global change of "/packages/"
to "/PPMPackages/5.005/" and I was able to install libnet just fine.
Be sure to make a backup copy of ppm.xml.
Dennis L. Cumro
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 09 Aug 2000 01:15:23 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: Upgrade 5.004 -> 5.6 and binary modules
Message-Id: <Lg2k5.14492$f_5.71160@news1.rdc1.ct.home.com>
Konstantinos Agouros <elwood@news.agouros.de> wrote:
> Hi,
> I am currently running 5.004 and I want to upgrade. I have quite a number
> of binary modules installed (some written by me). Does this work? I remember
> that I have seen a question 'backward compatibility for binary modules' in
> older version of perl. Is this still so?
Perl 5.6.0 can be built with support for 5.005 modules. Binary
compatibility was broken between perl 5.004 and 5.005. Too much changed
under the hood to maintain it.
Dan
------------------------------
Date: Wed, 09 Aug 2000 01:08:43 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: When does it pay to presize an array?
Message-Id: <va2k5.14489$f_5.71160@news1.rdc1.ct.home.com>
Andrew J. Perrin <aperrin@demog.berkeley.edu> wrote:
> I'm working on a project in which some fairly large arrays (around 100,000
> to 200,000 elements) will be loaded from a file. I will know ahead of
> time how many elements will be read in, so it is feasible to pre-size
> the arrays using $#array = nnn where nnn is the size of the array.
> perldoc perldata suggests that this will speed up the array filling
> process.
It will. Perl allocates some wiggle room in arrays, but when you blow that
room it reallocates the array. That means it allocates a new, larger chunk
of memory, copies the old chunk to the new chunk, and deallocates the old.
When you preallocate to the total size it doesn't have to do this.
> I wrote a quick timing script to see if it would be worthwhile to
> rewrite the pertinent code to do this. The script follows; to my
> surprise, results using array sizes of 1000 and 10000 are actually
> faster just push()ing each element than they are setting $#array and
> then populating it. Even at 100000, the difference is quite minor.
> I'd be interested in comments, including whether I've built in some
> fallacy into the test script and other ideas on the topic in general.
You have. Note that this:
> sub presize {
> my $size = shift;
> my @array;
> $#array = $size - 1;
> foreach (0..$#array) {
> $array[$_] = $_;
> }
> }
is not the same as this:
> sub bypush {
> my $size = shift;
> my @array;
> foreach (0..$size) {
> push(@array, $_);
> }
> }
You're pushing in the second case, which you aren't in the first. There's
more code involved under the hood.
Both can use the "$foo[$_] = $_;" trick. Try timing the two subs with
identical code except for the presize and see what you get.
Dan
------------------------------
Date: Wed, 09 Aug 2000 01:11:58 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: When does it pay to presize an array?
Message-Id: <yd2k5.14490$f_5.71160@news1.rdc1.ct.home.com>
Richard J. Rauenzahn <nospam@hairball.cup.hp.com> wrote:
> aperrin@demog.berkeley.edu (Andrew J. Perrin) writes:
>>nospam@hairball.cup.hp.com (Richard J. Rauenzahn) writes:
>>
>>[snip]...
>>>
>>> So, I made the following changes and got *significantly* better results:
>>
>>> $#array = $size - 1;
>>> $#array = -1; # change 1: This 'resets' the array,
>>> # but doesn't deallocate the memory.
>>
>> ^^^^^^^^^
>>Is this documented? I couldn't find it on an admittedly cursory glance.
> I've read somewhere that the only way to deallocate the memory is use
> undef, so I'm assuming that by not using undef, I'm not deallocating the
> array's storage.
Setting it to undef doesn't deallocate the storage either. (Though the
storage for the scalars in the array is released) Perl still holds on to
the underlying array structure, including the (now empty) big list 'o
pointers that perl uses to track array elements.
Dan
------------------------------
Date: 08 Aug 2000 23:01:46 -0400
From: aperrin@demog.berkeley.edu (Andrew J. Perrin)
Subject: Re: When does it pay to presize an array?
Message-Id: <u8zu7yw6d.fsf@demog.berkeley.edu>
Dan Sugalski <dan@tuatha.sidhe.org> writes:
> Andrew J. Perrin <aperrin@demog.berkeley.edu> wrote:
[snip]
> > perldoc perldata suggests that this will speed up the array filling
> > process.
>
> It will. Perl allocates some wiggle room in arrays, but when you blow that
> room it reallocates the array. That means it allocates a new, larger chunk
> of memory, copies the old chunk to the new chunk, and deallocates the old.
> When you preallocate to the total size it doesn't have to do this.
That's certainly what the docs suggest; however, I still can't find or
produce code that does it. In fact, the exchange between myself and
Richard Rauenzahn in this same thread showed that, in certain
circumstances with larger arrays, it was actually slower to presize
than not to.
[snip]
>
> > I'd be interested in comments, including whether I've built in some
> > fallacy into the test script and other ideas on the topic in general.
>
> You have. Note that this:
>
>
> > sub presize {
> > my $size = shift;
> > my @array;
> > $#array = $size - 1;
> > foreach (0..$#array) {
> > $array[$_] = $_;
> > }
> > }
>
> is not the same as this:
>
> > sub bypush {
> > my $size = shift;
> > my @array;
> > foreach (0..$size) {
> > push(@array, $_);
> > }
> > }
>
> You're pushing in the second case, which you aren't in the first. There's
> more code involved under the hood.
>
> Both can use the "$foo[$_] = $_;" trick. Try timing the two subs with
> identical code except for the presize and see what you get.
>
True enough - here you go. Also, see that exchange I noted above -
there's also comparable code there. The results follow; I would still
love to see some code that demonstrates the utility of presizing an array!
sub presize {
my $size = shift;
my @array;
$#array = $size - 1;
foreach (0..$size) {
$array[$_] = $_;
}
}
sub bypush {
my $size = shift;
my @array;
foreach (0..$size) {
$array[$_] = $_;
}
}
aperrin@brass ~> perl -v ; uname -a ; cat presizetest.out
This is perl, version 5.005_03 built for sun4-solaris
SunOS brass 5.7 Generic_106541-08 sun4u sparc SUNW,Ultra-4
100 elements:
Benchmark: timing 1000 iterations of Presized, Pushed...
Presized: 0 wallclock secs ( 0.29 usr + 0.00 sys = 0.29 CPU)
(warning: too few iterations for a reliable count)
Pushed: 0 wallclock secs ( 0.29 usr + 0.00 sys = 0.29 CPU)
(warning: too few iterations for a reliable count)
---*---
1000 elements:
Benchmark: timing 1000 iterations of Presized, Pushed...
Presized: 3 wallclock secs ( 2.85 usr + 0.00 sys = 2.85 CPU)
Pushed: 3 wallclock secs ( 2.73 usr + 0.00 sys = 2.73 CPU)
---*---
10000 elements:
Benchmark: timing 1000 iterations of Presized, Pushed...
Presized: 30 wallclock secs (29.70 usr + 0.00 sys = 29.70 CPU)
Pushed: 28 wallclock secs (27.68 usr + 0.00 sys = 27.68 CPU)
---*---
100000 elements:
Benchmark: timing 1000 iterations of Presized, Pushed...
Presized: 291 wallclock secs (285.82 usr + 0.04 sys = 285.86 CPU)
Pushed: 283 wallclock secs (279.48 usr + 0.01 sys = 279.49 CPU)
---*---
> Dan
--
----------------------------------------------------------------------
Andrew Perrin - Solaris-Linux-NT-Samba-Perl-Access-Postgres Consulting
aperrin@igc.apc.org - http://demog.berkeley.edu/~aperrin
----------------------------------------------------------------------
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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.
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 V9 Issue 3957
**************************************