[16428] in Perl-Users-Digest
Perl-Users Digest, Issue: 3840 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jul 29 03:05:30 2000
Date: Sat, 29 Jul 2000 00:05:16 -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: <964854316-v9-i3840@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sat, 29 Jul 2000 Volume: 9 Number: 3840
Today's topics:
Re: [GN]DBM_File question <bwalton@rochester.rr.com>
Re: Analog vs Cable connections (David Efflandt)
Re: Apology to perl newsgroup (Keith Calvert Ivey)
Re: Apology to perl newsgroup (Andrew Johnson)
Better way to do this pattern match? <mauldin@netstorm.net>
Re: Better way to do this pattern match? (Neil Kandalgaonkar)
Comparing a number to a string paul5544@my-deja.com
Converting strings to numbers for comparison paul5544@my-deja.com
Re: Delete records in 2 weeks time <jaurangNOjaSPAM@crosswinds.net.invalid>
Re: Delete records in 2 weeks time (Keith Calvert Ivey)
Error with dbd using Oracle gary_n@my-deja.com
Help needed with Net::Telnet <vgavan@hotmail.com>
Re: Help needed with Net::Telnet (Mark W. Schumann)
Re: Help: Date Match Problem in SQL/ DBD Oracle (John D Groenveld)
Re: hide or encrypted Per source? <rre1@ADSDJASDJASHDJHADJAHSLHLDKA.COM>
Re: hide or encrypted Per source? no.spam.tomtt@hotmail.com
how to query oracle database and send output to screen mr_potato_head@my-deja.com
Re: NEWB Q: CGI and DATABASSE <debjit@oyeindia.com>
Re: NEWB Q: CGI and DATABASSE (Mark W. Schumann)
parsing sites and speed problem..... <cam@home.com>
Re: parsing sites and speed problem..... (Mark W. Schumann)
Perl bowling: numerical sort. (Abigail)
Re: Perl bowling: numerical sort. (Randal L. Schwartz)
Re: Perl bowling: numerical sort. (Abigail)
Perl jobs? <peterp100@hotmail.com>
Re: Perl jobs? (Mark W. Schumann)
Re: Perl Position: Portland, OR (Mark W. Schumann)
Re: plotting graph <bwalton@rochester.rr.com>
Re: Problems with next; in subroutines (Keith Calvert Ivey)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 29 Jul 2000 04:32:21 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: [GN]DBM_File question
Message-Id: <39825E8B.BEC3CEBB@rochester.rr.com>
Federico Abascal wrote:
>
> Is it faster to create a [GN]DBM_File and add new keys and values one to
> one
> for example: while(....) { $tied_hash{...} = "..." } (n times)
> or to do:
> %tied_hash = %mem_hash (once)
...
> Federico
Why don't you
use Benchmark;
and see?
--
Bob Walton
------------------------------
Date: Sat, 29 Jul 2000 04:10:51 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Analog vs Cable connections
Message-Id: <slrn8o4pqo.4ah.efflandt@efflandt.xnet.com>
On Fri, 28 Jul 2000, schnurmann@my-deja.com <schnurmann@my-deja.com> wrote:
>Oh, I forgot to say what I suspect....it is trying to dial the modem in
>order to connect to network.
Depending upon your Win or MSIE version, in Internet, Properties,
Connections (or something like that), either tell it you are on a LAN or
to never connect. Hopefully you have your gateway and DNS set up properly
for your cable modem (which it should be if it uses DHCP for its IP). But
MSIE is still brain dead and tries to work offline even when I am on a LAN
connected to the internet. But Netscape has no such problem, so I would
not think a Perl script would, unless there is something wrong with DNS or
gateway. Also make sure that your /windows/hosts (not hosts.sam) does not
contain old info.
>In article <3981897d.1673740@news-server>,
> jcrae@bigpond.net.au wrote:
>> I suspect this is an ISP problem rather than a Perl problem (therefore
>> off-topic for which I apologise), but I have to start somewhere.
>>
>> I have a perl script which gets some web pages (and does various other
>> things). It has worked fine for a couple of years over analog dial up
>> lines, and via networks with ISDN links, on Win95, Win98 and WinNT. I
>> recently got a cable connection (Telstra's Big Pond Advance service in
>> Australia, FWIW), and the script doesn't work on this service. But it
>> still works on an analog modem dial up on the samePC.
>>
>> Here's a snippet of code showing the problem:
>> ==========================================
>> use IO::Socket;
>>
>> $host = "www.apcmag.com";
>> $remote = IO::Socket::INET->new( Proto => "tcp",
>> PeerAddr => $host,
>> PeerPort => "http(80)",
>> );
>>
>> unless ($remote) {die "Cannot connect to http daemon on host"};
>> print "Connection made\n";
>> $remote->autoflush(1);
>> $getname = "/start/";
>> print "About to GET $getname\n";
>> print $remote "GET $getname HTTP/1.0\n\n"; #Hangs here
>> while ( <$remote> ) {
>> print;
>> }
>> =============================================
>> On cable, it prints the diagnostic line "About to GET.." etc, then
>> hangs. It eventually exits, presumably on a time out.
>>
>> Anyone have any experience of this problem?
>>
>> Cheers
>> John Rae
>>
>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.
--
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: Sat, 29 Jul 2000 04:14:46 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: Apology to perl newsgroup
Message-Id: <398358d2.4100738@news.newsguy.com>
Larry Rosler <lr@hpl.hp.com> wrote:
>Despite the insinuations of some posters, I was sure that you weren't
>yet another avatar of our resident troll(s).
>
>Welcome, though how you get out of the many killfiles you already
>inhabit I don't know.
Well, if he became involved in interesting discussions and made
useful contributions, he might be quoted in enough other
people's messages that people would remove him from their
killfiles to see what they're missing. Also, some people clear
out their killfiles periodically or killfile only temporarily.
Or he could change his name.
But judging by how much he needs to learn about Perl and how the
group works, it might be better if he stuck to lurking for a
while, so the fact that he's been killfiled shouldn't really
matter.
--
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC
------------------------------
Date: Sat, 29 Jul 2000 06:16:03 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: Re: Apology to perl newsgroup
Message-Id: <DEug5.16432$k5.169940@news1.rdc1.mb.home.com>
In article <3981FE3A.D2807E3B@toy.eyep.net>,
jtoy <toyboy@toy.eyep.net> wrote:
! I recently posted an article callled "help newb Q perl guy just left"
! . The thread got out of hand because of the way I asked my question
! and then after people answered, I talked back rudely. I am sorry for
! causing trouble in here. If possible, I would like to join this
! newsgroup in hopes of learning and understanding perl and its
! community. If I am not welcome, I understand. Once again sorry, and
It is not that you are not welcome -- but I'd suggest just hanging
out for a while (lurking) ... after all, if you want to participate
in a community, the least you can do is watch the community for a
while and learn.
! I won't make any trouble anymore. Also, could anyone please tell me
! what a killfile is? I heard the name many times in hear, but have
If I killfile you (as in *plonk*) it means I will no longer see your
posts. You are probably not being read by many of the ones who can
help you if you have a question -- but take heart, some set expiry
dates on their killfile entries, so you still have a chance.
! never heard of it before. And finally, what specific material would
! you recommend for me to read to get a dip into perl? Thanks.
I can't give an unbiased recommendation for dead trees but,
perldoc perl
perldoc perltoc
perldoc perlfaq
those are a useful start to see what the perl distribution already
gives you for free.
andrew
--
Andrew L. Johnson http://members.home.net/perl-epwp/
It may be that your sole purpose in life is simply to
serve as a warning to others.
------------------------------
Date: Sat, 29 Jul 2000 01:53:18 GMT
From: Jim Mauldin <mauldin@netstorm.net>
Subject: Better way to do this pattern match?
Message-Id: <39823834.8E455436@netstorm.net>
Suppose you wanted to implement an Altavista-like search facility where
a term prefixed with + means "must have", a term prefixed with - means
"must not have", otherwise at least one of the remaining terms must be
found.
Here's as short as I can make it, but my handicap is still pretty high.
Is there a better way?
$_ = 'Larry +Moe -Curly Jeff Mutt Houdini +Mike'; # vary at will
$e = 'Once upon a time there was not only Houdini, but Mutt and Laurel,
but not Curly or Moe.';
push @musts, $1 while s/\+(\w+)\s?//;
push @nots, $1 while s/-(\w+)\s?//;
$nots = join '|', @nots;
$coulds = join '|', split ' ';
$match = $c = 0;
if ($coulds || @musts) { # something to look for - not just @nots
@all_musts = map {$e=~/$_/gi && ++$c} @musts;
$all_musts = ($c == @musts);
$no_nots = $e !~/$nots/;
$some_coulds = $e =~/$coulds/;
if (@musts) {
$match = ($all_musts && $no_nots);
}
elsif (@nots) {
$match = ($no_nots && $some_coulds);
}
else {
$match = $some_coulds;
}
}
print $e if $match;
-- Jim
------------------------------
Date: Sat, 29 Jul 2000 03:43:20 GMT
From: neil@brevity.org (Neil Kandalgaonkar)
Subject: Re: Better way to do this pattern match?
Message-Id: <8ltjf8$3g7$1@localhost.localdomain>
In article <39823834.8E455436@netstorm.net>,
Jim Mauldin <mauldin@netstorm.net> wrote:
>Suppose you wanted to implement an Altavista-like search facility where
>a term prefixed with + means "must have", a term prefixed with - means
>"must not have", otherwise at least one of the remaining terms must be
>found.
>
>Here's as short as I can make it, but my handicap is still pretty high.
>Is there a better way?
Your way was already pretty good IMO. No need to make needless optimizations.
One flaw was that you assumed keywords would be \w+, which wouldn't work
for "wouldn't work". :) Another was that you didn't protect your regexes
from metacharacters with \Q...\E (man perlre) or quotemeta (perldoc perlfunc).
Here's another way of doing what you did, which also gives a ranking to the
match. Depending on how many words you expect per query, it *might* be less
efficient (test it first!), since it doesn't group the nots and musts and
coulds all together.
#!/usr/bin/perl -w
use strict;
my $query = '-Larry +Moe Curly Jeff Mutt Houdini +Mike'; # vary at will
my $data = 'Mike said, Once upon a time there was not only Houdini,
but Mutt and Laurel, but not Curly or Moe. Curly Curly.';
print "Query: $query\nData: $data\nResults: ", alta($query, $data), "\n\n";
sub alta {
my ($query, $data) = @_;
my $score;
foreach my $token (split ' ', $query) {
my ($mod, $word) = ( $token =~ /^([+-]?)(\S+)/ );
my @match = ($data =~ /(\Q$word\E)/gi);
if ($mod eq '-') {
return 0 if @match;
} elsif ($mod eq '+') {
return 0 unless @match;
} else {
# if very paranoid, test if $mod was neither + nor -.
}
$score += @match;
}
return $score;
}
--
Neil Kandalgaonkar <neil@brevity.org>
------------------------------
Date: Sat, 29 Jul 2000 05:49:27 GMT
From: paul5544@my-deja.com
Subject: Comparing a number to a string
Message-Id: <8ltr97$pe2$1@nnrp1.deja.com>
I recently discovered this forum and have soaked
up quite a bit from all of the fantastic brains
here. I was hoping someone could provide some
help to a programmer new to the PERL language.
I am trying to compare two values together.
But they need to be converted to numbers.
Here is my current statement
if ($line =~ "<price>")
{
if ($line =~ /$target/i)
{
$found_flag = 1;
}
}
This works fine if $line and $target are equal.
However, I want the statement to be something like
if ($line =~ "<price>")
{
if ($line <= $target)
{
$found_flag = 1;
}
}
This way $found_flag=1 if the $target value is
equal to or less then (but greater then zero) the
$line value.
Can anyone help me to convert these values to
numbers for comparison?
Very much appreciate any help and thanks to all
those that contribute to the forum.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sat, 29 Jul 2000 05:53:22 GMT
From: paul5544@my-deja.com
Subject: Converting strings to numbers for comparison
Message-Id: <8ltrgh$pg1$1@nnrp1.deja.com>
I recently discovered this forum and have soaked up quite a bit from all
of the fantastic brains here. I was hoping someone could provide some
help to a programmer new to the PERL language.
I am trying to compare two values together.
But they need to be converted to numbers.
Here is my current statement
if ($line =~ "<price>")
{
if ($line =~ /$target/i)
{
$found_flag = 1;
}
}
This works fine if $line and $target are equal. However, I want the
statement to be something like
if ($line =~ "<price>")
{
if ($line <= $target)
{
$found_flag = 1;
}
}
This way $found_flag=1 if the $target value is equal to or less then
(but greater then zero) the $line value.
Can anyone help me to convert these values to numbers for comparison?
Very much appreciate any help and thanks to all those that contribute to
the forum.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 28 Jul 2000 19:58:43 -0700
From: Taurean <jaurangNOjaSPAM@crosswinds.net.invalid>
Subject: Re: Delete records in 2 weeks time
Message-Id: <01ba24e0.23e3d5db@usw-ex0108-061.remarq.com>
Will that extract the 9 digit reference number which starts
with a 9. I have another 8 digit telephone number starting
with 9 in the record, will this be extracted too?
* Sent from AltaVista http://www.altavista.com Where you can also find related Web Pages, Images, Audios, Videos, News, and Shopping. Smart is Beautiful
------------------------------
Date: Sat, 29 Jul 2000 04:56:07 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: Delete records in 2 weeks time
Message-Id: <3986616a.6300692@news.newsguy.com>
Taurean <jaurangNOjaSPAM@crosswinds.net.invalid> wrote:
>Will that extract the 9 digit reference number which starts
>with a 9. I have another 8 digit telephone number starting
>with 9 in the record, will this be extracted too?
It's good that you avoid quoting the entire post that you're
responding to, but a little context, just a few lines, can be
helpful. From your message's references it appears that you're
responding to my post suggesting
($records_seconds) = /Reference: (\d+)/;
Is your phone number preceded by "Reference: "?
By the way, you should be aware that a little over one year from
now (September 2001) your reference numbers will no longer start
with 9, and they'll be 10 digits long.
--
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC
------------------------------
Date: Sat, 29 Jul 2000 06:32:51 GMT
From: gary_n@my-deja.com
Subject: Error with dbd using Oracle
Message-Id: <8lttqk$qvk$1@nnrp1.deja.com>
I've recently installed DBD 1.05 for Oracle and DBI 1.13. I'm running
Oracle 8.05 and Apache 1.3.12.
I was able to get both DBD and DBI to make and test successfully and am
able to run DBD at the command line and select from the database ok. I
get the following error in the Apache error log when I try and run the
same perl file as a cgi script.
-------
install_driver(Oracle) failed: Can't load
'/usr/lib/perl5/site_perl/5.005/i386-linux/auto/DBD/Oracle/Oracle.so'
for module DBD::Oracle: libclntsh.so.1.0: cannot open shared object
file:
No such file or directory at
/usr/lib/perl5/5.00503/i386-linux/DynaLoader.pm line 169
-------
Now I can run other perl cgi files ok and this one works up unitl the
database select. I am setting LD_LIBRARY_PATH and ORACLE_SID ok as I've
outputted the environment to the web page. The libclntsh.so.1.0 file is
in $ORACLE_HOME/lib and has correct permissions.
Anyone any ideas where to look, I was using the latest version of DBD &
DBI but went down a version to see if it would make any difference but
it didn't. It seems like a permissions or file not found error but I
have 755 on the libraries and the parent directories.
Slightly confused and would love some help !
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sat, 29 Jul 2000 02:12:40 GMT
From: "vgavan" <vgavan@hotmail.com>
Subject: Help needed with Net::Telnet
Message-Id: <s4rg5.17698$5N1.621916@newsread1.prod.itd.earthlink.net>
Thank you for your help in advance.
It returns no data.
#!/usr/local/bin/perl
use Net::Telnet ();
$username = q(oracle);
$passwd = q(oracle);
$t = new Net::Telnet (Timeout => 10 , Prompt => "/\$/");
$t->open('0');
$t->login($username, $passwd);
$lines = $t->cmd('ps -ef | grep pmon_$ORACLE_SID');
print $lines;
------------------------------
Date: 29 Jul 2000 01:30:12 -0400
From: catfood@apk.net (Mark W. Schumann)
Subject: Re: Help needed with Net::Telnet
Message-Id: <8ltq54$mn3@junior.apk.net>
In article <s4rg5.17698$5N1.621916@newsread1.prod.itd.earthlink.net>,
vgavan <vgavan@hotmail.com> wrote:
>Thank you for your help in advance.
>It returns no data.
Good! I mean, at least you are telling us specifically what happens
instead of saying "it doesn't work." But now let me ask some more
questions before answering yours.
>#!/usr/local/bin/perl
append -w here.
>use Net::Telnet ();
Good idea to use the existing module. This will save a lot of work.
use strict;
>$username = q(oracle);
>$passwd = q(oracle);
>
>$t = new Net::Telnet (Timeout => 10 , Prompt => "/\$/");
|| die "can't create telnet object: $!".
>$t->open('0');
|| die "can't open telnet connection: $!".
>$t->login($username, $passwd);
|| die "can't login as \"$user\" with password \"$passwd\": $!";
>$lines = $t->cmd('ps -ef | grep pmon_$ORACLE_SID');
|| die "problem running command: $!" unless ($lines);
>print $lines;
From the manpage for Net::Telnet:
In a scalar context the characters read are discarded
and a boolean is returned indicating the success or
failure of sending the command string and reading the
prompt.
By causing Net::Telnet::cmd to return a scalar, you're asking it to
return just a success or failure code. Maybe you should have gotten a
1 or 0 or something on STDOUT instead of nothing at all. But you
probably meant to write something like this, which causes
Net::Telnet::cmd to return an array:
@lines = $t->cmd('ps -ef | grep pmon_$ORACLE_SID');
print join ("\n", @lines) . "\n";
But remember, "or die" is your friend.
------------------------------
Date: 28 Jul 2000 21:49:14 -0400
From: groenvel@cse.psu.edu (John D Groenveld)
Subject: Re: Help: Date Match Problem in SQL/ DBD Oracle
Message-Id: <8ltd6q$ac4$1@grolsch.cse.psu.edu>
Turn trace on and look carefully at the SQL you're passing to Oracle.
John
groenveld@acm.org
------------------------------
Date: Sat, 29 Jul 2000 13:42:55 +0800
From: DT <rre1@ADSDJASDJASHDJHADJAHSLHLDKA.COM>
Subject: Re: hide or encrypted Per source?
Message-Id: <MPG.13ecefbeac6529d1989681@news.newsguy.com>
Can anyone help? I paid for the source code and yet he give me this.
In article <8lsg7l$q13$1@brokaw.wa.com>, lauren_smith13@hotmail.com
says...
>
> <nospam.tomtt@hotmail.com> wrote in message
> news:MPG.13ec364036dd9176989680@news.newsguy.com...
> > Someone please help me the follow code? What is the all about, Million
> > Thanks
>
> It's about how clever the programmer could be. I'd fire him.
>
> Lauren
>
>
>
>
------------------------------
Date: Sat, 29 Jul 2000 13:43:52 +0800
From: no.spam.tomtt@hotmail.com
Subject: Re: hide or encrypted Per source?
Message-Id: <MPG.13eceff432878dbc989682@news.newsguy.com>
In article <8lsg7l$q13$1@brokaw.wa.com>, lauren_smith13@hotmail.com
says...
>
> <nospam.tomtt@hotmail.com> wrote in message
> news:MPG.13ec364036dd9176989680@news.newsguy.com...
> > Someone please help me the follow code? What is the all about, Million
> > Thanks
>
> It's about how clever the programmer could be. I'd fire him.
>
> Lauren
>
>
>
>
------------------------------
Date: Sat, 29 Jul 2000 06:46:56 GMT
From: mr_potato_head@my-deja.com
Subject: how to query oracle database and send output to screen
Message-Id: <8ltul0$rka$1@nnrp1.deja.com>
Hi,
I need to query my oracle database 8.1.6 on solaris 7 and send the
results to the screen. I might also need to send the output to a
file. I've looked into DBD and DBI but there are some modifications
that need to be done to some java oracle binaries to get it to work.
I'd rather not modify these files on my production server. I've done
this with informix:
#!/usr/local/bin/perl
$ENV{INFORMIXSERVER} = "n_shm";
open DBACCESS, "| /u/informix/bin/dbaccess";
print DBACCESS qq{
database mydatabase\@n_shm;
UNLOAD TO '/u/myfile'
SELECT *
FROM a_table;
};
close DBACCESS;
Can someone show me how to do this in oracle? Thanks in advance...
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sat, 29 Jul 2000 10:47:50 +0530
From: "Debjit" <debjit@oyeindia.com>
Subject: Re: NEWB Q: CGI and DATABASSE
Message-Id: <8luu94$l5t$1@news.vsnl.net.in>
I use MySQL 3.22 win32 binary. It works great!
eric_lyon@my-deja.com wrote in message <8lsfh9$pjd$1@nnrp1.deja.com>...
>PS: the OCELOT databasse is the only BD that i've found to do some SQL
>with win 95, is there a better (and free_ one ?
------------------------------
Date: 29 Jul 2000 01:34:30 -0400
From: catfood@apk.net (Mark W. Schumann)
Subject: Re: NEWB Q: CGI and DATABASSE
Message-Id: <8ltqd6$nia@junior.apk.net>
In article <8lsfh9$pjd$1@nnrp1.deja.com>, <eric_lyon@my-deja.com> wrote:
>I really need help ! i work with win95 and i'd like to connect my cgi
>scripts to my MS access databasse (or my OCELOT databasse), the problem
>is that i have no idea how i can do that, usually i test my CGI script
>on my computer using a local server (SAMBAR 4.1).
The module you might want is DBI.pm. Read its documentation. Experiment
with it. Come back here with questions once you've exhausted local
resources.
------------------------------
Date: Sat, 29 Jul 2000 01:45:02 GMT
From: "cam" <cam@home.com>
Subject: parsing sites and speed problem.....
Message-Id: <yGqg5.79125$8u4.816807@news1.rdc1.bc.home.com>
Hi:
I've got a small metasearch script on which I parse data from various 3rd
party search sites. I'm sure the syntax is correct in my script since all
engines I query parse just fine. The problem is an EXTREME variation in
speed. While a parsing of engine X may take one second, a parsing of engine
Y may take 20-40 seconds or even more....
Why would data from one site get parsed and displayed on my site in one or
two seconds while from another resource it takes up to 20-40 seconds or even
more? If I travel directly to engine X or Y and do a search, the query
results appears quickly on both. There seems to be no major discrepency in
terms of delivering the data, but rather in the parsing of it. Why is it
that when I parse this same data, one site takes an enormous amount of time
while another is almost spontaneous?
Any ideas? I'm stumped!!!
Thanks!
Cam Gray
cam@home.com
------------------------------
Date: 29 Jul 2000 01:32:23 -0400
From: catfood@apk.net (Mark W. Schumann)
Subject: Re: parsing sites and speed problem.....
Message-Id: <8ltq97$n2j@junior.apk.net>
In article <yGqg5.79125$8u4.816807@news1.rdc1.bc.home.com>,
cam <cam@home.com> wrote:
>Why would data from one site get parsed and displayed on my site in one or
>two seconds while from another resource it takes up to 20-40 seconds or even
>more? If I travel directly to engine X or Y and do a search, the query
>results appears quickly on both. There seems to be no major discrepency in
>terms of delivering the data, but rather in the parsing of it. Why is it
>that when I parse this same data, one site takes an enormous amount of time
>while another is almost spontaneous?
>
>Any ideas? I'm stumped!!!
I've got a great idea! Post some code!
------------------------------
Date: 28 Jul 2000 22:30:52 EDT
From: abigail@foad.org (Abigail)
Subject: Perl bowling: numerical sort.
Message-Id: <slrn8o4gei.vcg.abigail@alexandra.foad.org>
Honouring Guttman and Rosler who taught us how to avoid using blocks
while sorting, here's a way to do numerical sort without using a
sort block:
@sorted = map {length} sort map {$| x $_} @unsorted;
Abigail
--
$"=$,;*{;qq{@{[(A..Z)[qq[0020191411140003]=~m[..]g]]}}}=*_=sub{print/::(.*)/};
$\=$/;q<Just another Perl Hacker>->();
------------------------------
Date: 28 Jul 2000 19:47:49 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Perl bowling: numerical sort.
Message-Id: <m14s593b56.fsf@halfdome.holdit.com>
>>>>> "Abigail" == Abigail <abigail@foad.org> writes:
Abigail> Honouring Guttman and Rosler who taught us how to avoid using blocks
Abigail> while sorting, here's a way to do numerical sort without using a
Abigail> sort block:
Abigail> @sorted = map {length} sort map {$| x $_} @unsorted;
Or how about:
@sorted = map {0+$_} sort map {sprintf "%1000.500f", $_} @unsorted;
:-)
Dunno how to get it to work for negative numbers though. Not in 30
seconds, anyway. Abigail?
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: 28 Jul 2000 23:32:17 EDT
From: abigail@foad.org (Abigail)
Subject: Re: Perl bowling: numerical sort.
Message-Id: <slrn8o4k1l.vcg.abigail@alexandra.foad.org>
Randal L. Schwartz (merlyn@stonehenge.com) wrote on MMDXXIV September
MCMXCIII in <URL:news:m14s593b56.fsf@halfdome.holdit.com>:
`' >>>>> "Abigail" == Abigail <abigail@foad.org> writes:
`'
`' Abigail> Honouring Guttman and Rosler who taught us how to avoid using blocks
`' Abigail> while sorting, here's a way to do numerical sort without using a
`' Abigail> sort block:
`'
`' Abigail> @sorted = map {length} sort map {$| x $_} @unsorted;
`'
`' Or how about:
`'
`' @sorted = map {0+$_} sort map {sprintf "%1000.500f", $_} @unsorted;
`'
`' :-)
`'
`' Dunno how to get it to work for negative numbers though. Not in 30
`' seconds, anyway. Abigail?
@sorted = map {0+$_}
map {y/ 9876543210/-0-9/ if / /; $_}
sort
map {y/-0-9/ 9876543210/ if /-/; $_}
map {sprintf "%+01000.500f" => $_} @unsorted;
HTH. HAND.
Abigail
--
perl -wlne '}print$.;{' file # Count the number of lines.
------------------------------
Date: Fri, 28 Jul 2000 22:06:45 -0400
From: peter <peterp100@hotmail.com>
Subject: Perl jobs?
Message-Id: <kre4os899d2g278fl1i22bfeoj59ipmg0h@4ax.com>
I'm teaching myself perl and I'm taking a Java class this fall. But,
I'm thinking about dropping the Java class and concentrating on Perl.
Are there any jobs out there for perl programmers? When I look in the
paper everything says "Java and C ++" ???
------------------------------
Date: 29 Jul 2000 01:31:21 -0400
From: catfood@apk.net (Mark W. Schumann)
Subject: Re: Perl jobs?
Message-Id: <8ltq79$mt4@junior.apk.net>
In article <kre4os899d2g278fl1i22bfeoj59ipmg0h@4ax.com>,
peter <peterp100@hotmail.com> wrote:
>I'm teaching myself perl and I'm taking a Java class this fall. But,
>I'm thinking about dropping the Java class and concentrating on Perl.
>Are there any jobs out there for perl programmers? When I look in the
>paper everything says "Java and C ++" ???
Perl is a tool for getting your job done. If your job requires you
to do things that Perl is good at, you will want to learn Perl.
There is no such newsgroup as comp.lang.perl.
------------------------------
Date: 29 Jul 2000 01:35:58 -0400
From: catfood@apk.net (Mark W. Schumann)
Subject: Re: Perl Position: Portland, OR
Message-Id: <8ltqfu$nos@junior.apk.net>
[posted and emailed]
In article <%gjg5.677$au3.113590@news.uswest.net>,
Hiring Manager <jobs@onsitetech.com> wrote in comp.lang.perl.misc:
>ONSITE! Technology is looking for an motivated, resourceful Perl programmer
>with experience coding database-driven websites...
The really motivated, resourceful headhunters know that this is not
a jobs group.
>Go on, impress us with your portfolio.
$clue_level{'onsitetech.com'} = -1;
How's that?
>Send your cover letter and resume to: jobs@onsitetech.com or fax it to
>503-233-8016.
>
>No phone calls please.
No job postings please.
------------------------------
Date: Sat, 29 Jul 2000 03:07:03 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: plotting graph
Message-Id: <39824A8C.9557EEC2@rochester.rr.com>
dVoon wrote:
>
> In article <397FAE07.D4188449@rochester.rr.com>,
> Bob Walton <bwalton@rochester.rr.com> wrote:
> > dVoon wrote:
> > ...
> > > I know how to use Perl to retrieve data from database and then
> generate
> > > an HTML table. But is there a way of using Perl to plot graphs (e.g.
> > > line graph showing composite index) and send the graph to HTML
> client? I
> > > thought of using Perl to retrieve the data and send it to a java
> applet
> > > (which plots graphs) as argument, but since I don't know java, are
> there
> > > other ways to do it?
> > ...
> > > Daniel
> > ...
> > Sure. Just include an <img src="whatever.pl"> tag in your CGI
> script's
> > output, and write whatever.pl to generate a Content-type corresponding
> > to an image, like image/gif, perhaps. Then use any image-generation
> > module in Perl, like maybe GD, to create an image of the type
> specified
> > in Content-type on standard output. Best to set STDOUT to binmode. I
> > find this technique works very well for generating on-the-fly graphs
> of
> > data for the web. If you need to pass parameters from the generated
> > HTML to whatever.pl, you can do that by placing them like <img
> > src="whatever.pl?p1=v1&p2=v2">. Of course, it is good to include the
> > width and height of the image in the img tag so the web page will
> render
> > before the image is compeltely transmitted.
> > --
> > Bob Walton
> >
>
> Thanks Bob. Do you have any working example on using GD module to plot
> graphs? And where do I get more info on this module?
>
> Daniel
...
All my real examples are proprietary to my company, but here is a
quickie that shows one way:
#program GDtest.pl:
use CGI qw(:standard);
print header,
start_html('GD Example'),
h1('GD Example'),
start_form,
textfield('n1'),p,
textfield('n2'),p,
textfield('n3'),p,
textfield('n4'),p,
"Enter four numbers from 0 to 100 and submit",p,
submit,
end_form,
hr;
if(param()){
print img{src=>'GDtestImage.pl?n1='.param('n1').
'&n2='.param('n2').'&n3='.param('n3').
'&n4='.param('n4'),width=>100,height=>100};
}
print end_html;
************************************************************************
#program GDtestImage.pl:
use CGI qw(:standard);
use GD;
print "Content-type: image/gif\n\n";
binmode STDOUT;
$im = new GD::Image(100,100);
$lightpurple=$im->colorAllocate(255,200,255);
$black=$im->colorAllocate(0,0,0);
$im->interlaced('true');
$im->line(param('n1'),param('n2'),param('n3'),
param('n4'),$black);
print $im->gif;
**************************************************************************
Note that as shown, this will work only with a version of GD that
supports GIF's. The first edition of the Perl Resource Kit for Win32 had
such a version of GD (I don't know about later versions of the PRK) --
it seems that more recent versions of GD do not have gif support. You
can use png if you don't have a GD with gif. But then you need browser
support for png.
--
Bob Walton
------------------------------
Date: Sat, 29 Jul 2000 04:01:51 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: Problems with next; in subroutines
Message-Id: <3982552e.3168168@news.newsguy.com>
"Dave A." <noemail@nodomain.com> wrote:
> foreach $port (@ports) {
> $SIG{"ALRM"} = sub {
> print "Timed Out connecting to port: $port\n";
> if ($socket) { close ($socket); }
> next;
> };
[snip]
That "next" is inside the anonymous subroutine, which doesn't
contain a loop. The code in the anonymous subroutine isn't part
of the code outside it. I don't understand what you're trying
to accomplish with the "next", so I can't advise you further.
--
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC
------------------------------
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 3840
**************************************