[12014] in Perl-Users-Digest
Perl-Users Digest, Issue: 5614 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon May 10 01:17:13 1999
Date: Sun, 9 May 99 22:01:34 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sun, 9 May 1999 Volume: 8 Number: 5614
Today's topics:
index() <toddm@waltz.rahul.net>
Re: index() (Andrew Johnson)
Re: Installing Perl in PWS <Glen@right.com>
Like on mIRC? <selectthree@gsig-net.qc.ca>
Re: Like on mIRC? <gellyfish@gellyfish.com>
Re: Looking for a book ... <propart@mediaone.net>
mod_perl must have wierd magic going on or something. <newsgroups@reza.net>
Re: need a perl script? <gellyfish@gellyfish.com>
Re: need a perl script? <flavell@mail.cern.ch>
Re: Newbie <jbc@shell2.la.best.com>
NT IPC$ connection in Perl <carvdawg@patriot.net>
Perl and Lisp psdsp@my-dejanews.com
Re: Perl bug in v5.005 : foreach variable uninitialized (Ilya Zakharevich)
Re: processor usage todd_b_smith@my-dejanews.com
Re: processor usage <flavell@mail.cern.ch>
regex question <candree@one.net.au>
Re: regex question (Tad McClellan)
Re: regex question <gellyfish@gellyfish.com>
Re: Rejecting unwanted hits <writer@wi.net>
Re: Security issues wth Perl-Win32 <metcher@spider.herston.uq.edu.au>
Re: Socket.pm - How to change the timeout? <gellyfish@gellyfish.com>
Re: Sorting is too slow for finding top N keys... - UPD (Marko R. Riedel)
Re: Sorting is too slow for finding top N keys... - UPD (Michel Dalle)
SRC: Whois (was Re: need a perl script?) <gellyfish@gellyfish.com>
undefined statements in perl?? (Rahim Aladin)
Web form "debugger" for MacPerl witte_j@denison.edu
what does the following do? (Rahim Aladin)
Re: Why does NT server return the actual script, not th <gellyfish@gellyfish.com>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 9 May 1999 18:42:27 GMT
From: Todd McLaughlin <toddm@waltz.rahul.net>
Subject: index()
Message-Id: <7h4kuj$peh$1@samba.rahul.net>
Is there a way to use regular expressions with index() instead
of a "string"? Or possibly a way to mimic it's behavior
some how to enable the use of regular expressions?
I want to do:
$position = index($string, /string/);
I need to get the index in a $string of some text.
Thanks!
Todd
------------------------------
Date: Sun, 09 May 1999 19:05:11 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: Re: index()
Message-Id: <H%kZ2.4116$lQ1.736209@news2.rdc1.on.home.com>
In article <7h4kuj$peh$1@samba.rahul.net>,
Todd McLaughlin <toddm@waltz.rahul.net> wrote:
! Is there a way to use regular expressions with index() instead
! of a "string"? Or possibly a way to mimic it's behavior
! some how to enable the use of regular expressions?
!
! I want to do:
! $position = index($string, /string/);
!
! I need to get the index in a $string of some text.
check out the pos() function which returns the offset of
where a m//g match left off:
perldoc -f pos
In this example, we return -1 if no match, otherwise we subtract the
length of the match from offset (searching for a regex matching
'string'):
$_ = 'this is a string of text';
$pos = m/(\bs\w+)/g ? pos() - length($1) : -1;
print "$pos\n";
of course, if you make your pattern a zero-width assertion, then
there is no length to subtract:
$_ = 'this is a string of text';
$pos = m/(?=\bs\w+)/g ? pos() : -1;
print "$pos\n";
regards
andrew
------------------------------
Date: Sun, 9 May 1999 19:03:32 -0400
From: "Glen" <Glen@right.com>
Subject: Re: Installing Perl in PWS
Message-Id: <3736151c@news-in.ispchannel.com>
I don't know what installations you've tried, but activeperl from
www.activeperl.com has worked for me for months on myriads of systems.
It installs with a pretty windows installation that makes it easy & also
insulting to unix folks.
-g
DANIEL YOUNT <ayount@worldnet.att.net> wrote in message
news:7h452n$bvq$1@bgtnsc02.worldnet.att.net...
> I am fairly new to Perl and have no knowledge whatsoever of sever
> configuration, but what I am trying to do is learn perl on my pc with the
> PWS. I have attempted the recommended installations of Perl from various
> web sites with no luck. I am guessing that a vital but overlooked(and
> obvious to anyone else) step has been left out. If anyone could help me
out
> I would really appreciate it.
> Thanks,
> Daniel
>
>
------------------------------
Date: Sun, 09 May 1999 14:32:12 -0400
From: Pierre-Luc <selectthree@gsig-net.qc.ca>
Subject: Like on mIRC?
Message-Id: <3735D4AB.B3B12504@gsig-net.qc.ca>
Hi,
When I use the REMOTE_ADDR environment variable, I get my IP, not, as
example, modem83.gsig-net..qc.ca. However, in mIRC, they are able to
identify me as modem 83.gsig-net.qc.ca. How can I do that? Is it
possible in PERL?
Please help me,
Pierre-Luc Soucy
------------------------------
Date: 9 May 1999 20:35:09 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Like on mIRC?
Message-Id: <7h4rht$63e$1@gellyfish.btinternet.com>
On Sun, 09 May 1999 14:32:12 -0400 Pierre-Luc wrote:
> Hi,
>
> When I use the REMOTE_ADDR environment variable, I get my IP, not, as
> example, modem83.gsig-net..qc.ca. However, in mIRC, they are able to
> identify me as modem 83.gsig-net.qc.ca. How can I do that? Is it
> possible in PERL?
>
Of course it is possible.
You will need to look at the perlfunc manpage entry for gethostbyname(),
the perlipc manpage and so forth ...
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sun, 09 May 1999 15:10:10 -0400
From: PropART <propart@mediaone.net>
Subject: Re: Looking for a book ...
Message-Id: <3735DD92.59DABADD@mediaone.net>
marzoram@my-dejanews.com wrote:
> Hello,
>
> Perl is the only language I have used until now for my job, but now I need to
> learn C (for some network programming: Linux, NT). Can anybody recommend a
> book on C which doesn't take me through all the "Hello World" programs and
> somehow builds up on my prior knowledge of Perl? I.e the book shouldn't have
> to cover basics like for and while loops extensively. All the books I've seen
> all start will absolute basics. Is there a Camel book for C or something like
> that, that can used as a reference?
>
> Any reply appreciated, thanks in advance,
>
> Marco
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
I've checked out a lot of C books and never really seen one that leveraged Perl
knowledge.
To me these were the best of the best...
A Book on C by Kelley and Pohl
C: A Reference Manual by Harbison and Steele
Deep C Secrets by van der Linden
--William C.
------------------------------
Date: Sun, 09 May 1999 12:54:28 -0700
From: Reza Naima <newsgroups@reza.net>
Subject: mod_perl must have wierd magic going on or something.
Message-Id: <3735E7F4.F4BBF62@reza.net>
Ok, I'm getting the following bit of strageness going on. I'm trying to
compile mod_perl on a 2.0.36 version of linux (redhat 5.2 install), perl
is 5.005_02 (perl -V below). Apache is 1.3.6, mod_perl is 1.19. It
actually compiles cleanly, but when I do a make test, I get strange
failures, and I can't figure out how it was supposed to work... For
example, with the modules/file.t test, I get this output :
-------------
[SNIP]
ServerError:
Can't locate object method "new" via package "Apache::File" at
/usr/local/src/mod_perl-1.19/t/net/perl/file.pl line 15, <b> chunk 1.
[SNIP]
-----------------------------------------
Now, If you look at Apache::File, the only method defined is a tmpfile.
However, the file.pl file has in it :
require Apache::File;
print "1..6\n";
my $fh = Apache::File->new;
but I don't see any @ISA set anywere... Now, I've gotten the same
version of mod perl (1.19) and apache (1.3.6) to compile on a solaris
box without any problems, but this one confuses me. I really am
reluctant to rebuild perl, but I've tried everything and am running out
of options. Any suggestions would be greatly appreciated. Please also
cc: perl_question[AT]reza[DOT]net as I'll probably miss the reply
otherwise.
Thanks Alot!
Reza
beta:/usr/local/src/t2/mod_perl-1.19/t >perl -V
Summary of my perl5 (5.0 patchlevel 5 subversion 2) configuration:
Platform:
osname=linux, osvers=2.0.36, archname=i686-linux-thread
uname='linux XXXXX.com 2.0.36 #1 tue oct 13 22:17:11 edt 1998 i686
unknown '
hint=recommended, useposix=true, d_sigaction=define
usethreads=define useperlio=undef d_sfio=undef
Compiler:
cc='gcc', optimize='-O2', gccversion=2.7.2.3
cppflags='-D_REENTRANT -Dbool=char -DHAS_BOOL'
ccflags ='-D_REENTRANT -Dbool=char -DHAS_BOOL'
stdchar='char', d_stdstdio=define, usevfork=false
intsize=4, longsize=4, ptrsize=4, doublesize=8
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
alignbytes=4, usemymalloc=n, prototype=define
Linker and Libraries:
ld='gcc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lnsl -ldl -lm -lpthread -lc -lposix -lcrypt
libc=, so=so, useshrplib=false, libperl=libperl.a
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'
Characteristics of this binary (from libperl):
Built under linux
Compiled at Feb 6 1999 12:13:53
@INC:
/usr/local/lib/perl5/5.00502/i686-linux-thread
/usr/local/lib/perl5/5.00502
/usr/local/lib/perl5/site_perl/5.005/i686-linux-thread
/usr/local/lib/perl5/site_perl/5.005
.
------------------------------
Date: 9 May 1999 17:45:13 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: need a perl script?
Message-Id: <7h4hj9$5k4$1@gellyfish.btinternet.com>
[Posted and mailed]
On Sun, 09 May 1999 14:47:19 GMT cindycrawford@my-dejanews.com wrote:
> need a free perl script or need a perl script installed?
> check our site at http://cgi-shop.com
>
Thats it. Cindy - if you persist in this spamming I will personally
be straight onto DejaNews and also starnets.ro, whoever they may be
but I presume they are either your employer or ISP.
However you might see it your posting this should be considered
Net abuse. On every occasion when you have posted in response to
a question it has been found that there is no immediate solution
to be found on your site. If you feel that is harsh please feel
free to post some code as a rebuttal.
Now some might feel that this is poor netiquette; posting this to
the group however serves to register my distaste at your behaviour
to the other users of the group and thus alerting them to any
subsequent actions on my part - also publicizing my distaste
might discourage others from this abusive practice.
BTW if anyone else can get more info on 194.102.137.17 then I would
be grateful - I dont have 'whois' on this machine at the moment (and
I cant spend 10 minutes writing one ?).
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sun, 9 May 1999 21:01:28 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: need a perl script?
Message-Id: <Pine.HPP.3.95a.990509205606.23750J-100000@hpplus01.cern.ch>
On 9 May 1999, Jonathan Stowe wrote:
> BTW if anyone else can get more info on 194.102.137.17 then I would
> be grateful
Oh, mercy:
[...]
18 at-appliednetsat-1-0.appliedtheory.net (169.130.112.106) 102 ms
106 ms 120 ms
19 e0.nsx-a2.netsatx.net (207.241.161.17) 98 ms 104 ms 102 ms
20 netsat-adisam-canad.netsatx.net (209.2.191.74) 671 ms 678 ms 704
ms
21 two.canad.ro (193.230.177.194) 680 ms 677 ms 666 ms
22 canad-wan-i.starnets.ro (193.226.126.74) 672 ms 679 ms 733 ms
23 brasovr-wan.starnets.ro (193.226.126.229) 693 ms 705 ms 899 ms
24 sibiu-wan.starnets.ro (193.226.126.233) 1676 ms 1834 ms 1485 ms
25 193.226.126.197 (193.226.126.197) 1290 ms * 3376 ms
26 net-cisco.starnets.ro (193.226.122.193) 4683 ms * 5101 ms
27 net-gw.starnets.ro (193.226.122.195) 3315 ms 2171 ms 1196 ms
28 193.226.122.197 (193.226.122.197) 2913 ms 2019 ms 2015 ms
29 194.102.137.17 (194.102.137.17) 2594 ms 2105 ms 2222 ms
Admire those TTLs and RTTs. And Count Dracula can't be far away.
------------------------------
Date: 09 May 1999 18:14:40 GMT
From: John Callender <jbc@shell2.la.best.com>
Subject: Re: Newbie
Message-Id: <3735d090$0$229@nntp1.ba.best.com>
Thomas Malindovszky <dragotom@mail.datanet.hu> wrote:
> My perl script create a html form from a database, and I want this
> script to
> decode the form data.
You should probably look at the documentation for CGI.pm, at:
http://stein.cshl.org/WWW/software/CGI/cgi_docs.html
Also, as you'll no doubt be hearing, many of the regular users of this
group would prefer that such questions be asked in a different group,
comp.infosystems.www.authoring.cgi. Realistically, you'll probably get
better responses there with this type of question.
--
John Callender
jbc@west.net
http://www.west.net/~jbc/
------------------------------
Date: Sun, 09 May 1999 19:29:30 +0100
From: Marquis de Carvdawg <carvdawg@patriot.net>
Subject: NT IPC$ connection in Perl
Message-Id: <3735D40A.9882813A@patriot.net>
What's the best way to perform a connection to the IPC$ share
in NT in Perl, without using "net use"? Is it Win32::NetResource::
AddConnection? Or is there a better way?
Thanks
C
------------------------------
Date: Sun, 09 May 1999 18:24:02 GMT
From: psdsp@my-dejanews.com
Subject: Perl and Lisp
Message-Id: <7h4js0$lgi$1@nnrp1.deja.com>
I have a CGI script written in Perl that needs to communicate with a AI
program written in Common Lisp.
I am thinking of using a file to pass information between Perl and Lisp. Is
there any better interprocess communication mechanism available for Perl and
Lisp?
Any help would be gratefully appreciated.
-Deva
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 9 May 1999 19:05:19 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Perl bug in v5.005 : foreach variable uninitialized when returned?
Message-Id: <7h4m9f$9ti$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Steve Kay
<steve@peachy.com>],
who wrote in article <926268544.13712.0.nnrp-07.9e983059@news.demon.co.uk>:
> I seem to have run into the bug below, where a foreach variable cannot be
> returned from a subroutine.
> sub a {
> foreach $b (1 .. 5) {
> return $b;
> }
> }
This was fixed immediately after release of 5.005. Upgrade.
Ilya
------------------------------
Date: Sun, 09 May 1999 22:20:11 GMT
From: todd_b_smith@my-dejanews.com
Subject: Re: processor usage
Message-Id: <7h51mq$v1f$1@nnrp1.deja.com>
In article <slrn7j5130.k34.sholden@pgrad.cs.usyd.edu.au>,
sholden@cs.usyd.edu.au wrote:
> On Fri, 07 May 1999 05:41:24 GMT, tbsmith@deltacom.net wrote:
> >How can i run a program that uses infinite loops without using 99% of the
> >processor?
>
> Instead of asking again why don't you read the answers to the first post
> you made...
>
sorry, i didn't see it listed after a few days and thought my news server had
canceled it
> *plonk*
>
> --
> Sam
>
> Simple rule: include files should never include include files.
> --Rob Pike
>
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Mon, 10 May 1999 01:06:21 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: processor usage
Message-Id: <Pine.HPP.3.95a.990510005940.10294A-100000@hpplus01.cern.ch>
On Sun, 9 May 1999 todd_b_smith@my-dejanews.com wrote:
> sorry, i didn't see it listed after a few days and thought my news server had
> canceled it
http://www.dejanews.com is out there, whether you like it or not: so
you may as well use it, and stop wasting the time and resources of a
world-wide usenet group.
> > *plonk*
> >
> > --
> > Sam
> >
> > Simple rule: include files should never include include files.
> > --Rob Pike
And your comment on all that was precisely...what?
Please find your delete function. I think I might be entitled to say
that the group's participants have better things to do with our time
than to pick our way through your droppings.
------------------------------
Date: Mon, 10 May 1999 10:17:12 +1000
From: "chris" <candree@one.net.au>
Subject: regex question
Message-Id: <3736254d.0@pink.one.net.au>
I am a newbie to Perl and am having trouble with regexes. If I want to
substitute 'or' with 'our' for example but only in words that end in 'or'
and have more than 4 letters then s/ \S{3,}or/our/g; will replace words
such as 'color' with 'our' instead of 'colour' .
How do I detect strings but only substitute parts of them. I hope this is
clear enough.
Thanks in advance.
Chris Andree
------------------------------
Date: Sun, 9 May 1999 08:24:21 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: regex question
Message-Id: <lpu3h7.tga.ln@magna.metronet.com>
Glenn (nb@pup.com.au) wrote:
: I want to match all strings ending in 'or' and that have more than four
: letters...
: It should replace 'or' with 'our'
: eg flavor -> flavour
: but 'or' -> 'or'
: the problem is how do I achieve this without changing for example 'flavor'
: to 'our'.
s/([a-zA-Z]{3,})or\b/$1our/g;
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 9 May 1999 18:50:27 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: regex question
Message-Id: <7h4ldj$5ma$1@gellyfish.btinternet.com>
On Sun, 9 May 1999 09:11:05 -0700 Larry Rosler wrote:
> $_ = "For more flavor, add more humor, or poor liquor!\n";
>
> s/\b([a-z]+[b-df-hj-np-tv-z])or\b/$1our/gi;
>
> print;
> __END__
>
> For more flavour, add more humour, or poor liquor!
>
> I'm not sure about the British spelling -- liquour? Then allow 'u' in
> the regex. Nothing will be perfect, of course, except using a hash
> lookup for 'all' words that need to be changed.
>
I'm not sure about 'liquour' but what about 'saviour' ? (Which would of
course break 'excelsior'). There is a moral to this but I leave it to
the (Human) language pedants to expand.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sun, 09 May 1999 11:38:28 -0500
From: Ed Lake <writer@wi.net>
To: rich@newsguy.com
Subject: Re: Rejecting unwanted hits
Message-Id: <3735BA04.E685BF0@wi.net>
Ed Lake wrote:
> Charles R. Thompson wrote:
>
> > >Thanks again. Unfortunately, news:comp.infosystems.www.authoring.cgi
> > doesn't seem
> > >to be a newsgroup available on my news server. Is it something
> > special like the
> > >Netscape newsgroups that you can only access via the Netscape web
> > site? I get
> > >30,000 newsgroups, but not that one. It's not on either one of the
> > two news
> > >servers I use.
> >
> > I find that almost impossible to fathom. Out of *30,000* groups that
> > one is gone? Did you look for only...
> >
> > comp.infosystems.www.authoring.cgi
> >
> > and not the news part? (Sorry... gotta ask)
> >
> > This baffles the heck out of me.
> >
> > CT
>
> Charles,
>
> I put the news: part at the start of the URL just to make it "hot" so I
> could see if I could click on it to get to that newsgroup, but it didn't
> work. It just isn't available on Newsguy nor my regular news server
> news.inc.net. Here are the only newsgoups I get that begin with
> comp.infosystems: http://extra.newsguy.com/~detect/newsgrp1.jpg
>
> I'll carbon copy my news server on this to see what they have to say.
>
> Ed
Charles & Rich,
I just went to Newsguy's Direct News Read interface and found that there was
no problem getting to comp.infosystems.www.authoring.cgi, so there must be
some problem with the way Communicator 4.06 loads the directory of
newsgroups when I use their news reader. If it isn't on the directory,
then Communicator 4.06 thinks it doesn't exist.
I'll have to figure out how to fix that. It's a Netscape problem, not a
newsguy problem. Thanks for bringing this to my attention. Sorry for any
confusion.
Ed
------------------------------
Date: Mon, 10 May 1999 14:35:09 +1000
From: Jaime Metcher <metcher@spider.herston.uq.edu.au>
Subject: Re: Security issues wth Perl-Win32
Message-Id: <373661FD.E2389794@spider.herston.uq.edu.au>
You might be thinking about the old "Don't put your executable in your
cgi-bin directory" scare. If you are thinking about doing your sysadmin
stuff via http, read the WWW Security FAQ (available somewhere on the
net). This is applicable to any CGI setup, not just Perl.
If you aren't using CGI, all you have to know about is Windows security
- which, if you're a Windows NT sysadmin, you'll have to know anyway.
In this context, Perl is no more of a threat than Windows Explorer.
They are both just programs, and you can destroy your system with either
of them.
--
Jaime Metcher
Darren Bennett wrote:
>
> FUD?? whatever.. I have read (many places including ACTIVE STATE and Linux
> Journal) that Perl opens up some BARN Door Exploits.. I just don't know them
> and it is hard to secure that which you don't know is open..
>
> -Darren
>
------------------------------
Date: 9 May 1999 19:09:00 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Socket.pm - How to change the timeout?
Message-Id: <7h4mgc$5ms$1@gellyfish.btinternet.com>
On 9 May 1999 13:26:49 GMT Stratton Haley wrote:
>
> The problem is, I want the call:
>
> gethostbyaddr( inet_aton ( $ip ), AF_INET )
>
> to timeout after (say) 10 seconds, instead of the several minutes it now
> takes.
>
> Would someone please direct me to to the exceedingly obvious documentation
> that explains how to change the default timeout of this call?
>
You cannot specify a timeout for this operation explicitly but you can
use alarm() to cause the operation to be interrupted by a SIGALRM - if
you look at the perlfunc entry for alarm() then it goes into some detail
how you can use 'eval' and alarm() to cause some system operation to
be interrupted - I wont repeat the code here because the example is
fairly clear and *does work* - please post back here if you have trouble
with this approach ..
Anyhow, and this might be impolite to ask in public but hey !, why is it
that you have a different name every time you post - including but not
limited to :
Nordstrom Walt
Armstrong Boca
Greensboro Blum
Hank Snatch
Turin Waterbury
Shari Callaghan
Africa Ritter
Wappinger Mary
Mackey Hamilton
Len Bolivia
Loki Cushman
Eliot Copeland
Hewitt Marjorie
Riemann Medici
Gustafson Cossack
Stratton Haley
I figure there's some program at work there - care to elucidate ?
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 09 May 1999 22:32:26 +0200
From: mriedel@neuearbeit.de (Marko R. Riedel)
Subject: Re: Sorting is too slow for finding top N keys... - UPDATE
Message-Id: <lzvhe2oug5.fsf@linux_sexi.neuearbeit.de>
Greetings.
I suggest that you consider using quickselect. A sample implementation
is included below.
[SNIP] > ./qselect.pl 8 5 6
constructing permutation ... done.
1 4 6 7 2 3 5 8
6 7
[SNIP] >
This will cope with args like '65536 100 120'. (The permutation
constructor is slow. I wanted output that would be easy to verify.)
TODO:
1. perlify
2. sort in place
3. 'cmp' argument
4. time & evaluate.
Marko R. Riedel
#! /usr/bin/perl -w
#
sub qsel {
local ($aref, $min, $max) = @_;
local ($temp, $pivot);
local (@lower, @upper);
return $aref if(!$#$aref);
if($#$aref==1){
if($$aref[0]>$$aref[1]){
$temp=$$aref[0];
$$aref[0]=$$aref[1];
$$aref[1]=$temp;
}
return $aref;
}
$pivot=$$aref[0];
for $element (@$aref[1..$#$aref]){
if($element<$pivot){
push @lower, $element;
}
else{
push @upper, $element;
}
}
if($#lower!=-1 && $min<=$#lower){
&qsel(\@lower, $min, $max);
@$aref[0..$#lower]=@lower;
}
$$aref[$#lower+1]=$pivot;
if($#upper!=-1 && $max>=$#lower+2){
&qsel(\@upper, $min-($#lower+2), $max-($#lower+2));
@$aref[$#lower+2..$#$aref]=@upper;
}
return $aref;
}
sub makeperm {
local ($size)=@_;
local ($i);
local @perm=(-1) x $size;
local @source=(0..$size-1);
for($i=$size; $i>0; $i--){
$invs=int(rand($i));
$perm[$source[$invs]]=$i;
splice @source, $invs, 1;
}
return \@perm;
}
MAIN: {
local ($size, $min, $max)=@ARGV;
local ($perm);
$|=1;
print 'constructing permutation ... ';
$perm=&makeperm($size);
print "done.\n";
print "@$perm\n" if $size<=256;
&qsel($perm, $min, $max);
print "@$perm[$min..$max]\n";
}
------------------------------
Date: Sun, 09 May 1999 22:50:46 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: Sorting is too slow for finding top N keys... - UPDATE
Message-Id: <7h53ek$8vs$1@xenon.inbe.net>
In article <lzvhe2oug5.fsf@linux_sexi.neuearbeit.de>, mriedel@neuearbeit.de (Marko R. Riedel) wrote:
>
>
>Greetings.
>
>I suggest that you consider using quickselect. A sample implementation
>is included below.
[snip]
I haven't adapted it to a hash context yet, but based on simple sorting speed,
this one is a winner for the moment, or at least a tie with Bart's solution
(< 2 seconds)
Current speed is :
Marko1 : 1.92 seconds (but not adapted to hash yet)
Bart1 : 2.09 seconds
Larry1 : 2.97 seconds
Larry2 : 3.84 seconds
Michel3 : 3.85 seconds
Michel2 : 38.12 seconds
Michel1 (= simple Perl sort) : xx minutes
In case you're wondering how Larry1 & Larry2 got ahead of Michel3 suddenly,
well, I upgraded to the latest Perl version now, and it seems to prefer Larry
for some reason :-)
More details after benchmarking...
Michel.
------------------------------
Date: 9 May 1999 22:13:59 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: SRC: Whois (was Re: need a perl script?)
Message-Id: <7h51b7$6ie$1@gellyfish.btinternet.com>
On 9 May 1999 17:45:13 -0000 Jonathan Stowe wrote:
>
> BTW if anyone else can get more info on 194.102.137.17 then I would
> be grateful - I dont have 'whois' on this machine at the moment (and
> I cant spend 10 minutes writing one ?).
>
That was a pathetic excuse on my part - of course one can write a 'whois'
in a matter of seconds and here for all of you who hadnt thought of
such of a thing it is - you too can nail them spammers ;-P
#!/usr/bin/perl -w
use Socket;
use strict;
use Getopt::Std;
my %opt;
my ($remote,$port, $iaddr, $paddr, $proto, $line);
getopts('h:',\%opt) || die <<EOUSAGE;
usage: $0 [-h whois server] <whois query string>
EOUSAGE
$remote = $opt{'h'} || 'whois.internic.net';
$port = getservbyname('whois','tcp');
my $query = shift;
$iaddr = inet_aton($remote) || die "no host: $remote";
$paddr = sockaddr_in($port, $iaddr);
$proto = getprotobyname('tcp');
socket(SOCK, PF_INET, SOCK_STREAM, $proto) || die "socket: $!";
connect(SOCK, $paddr) || die "connect: $!";
select SOCK;
$| = 1;
print SOCK "$query\015\012";
select STDOUT;
while($line = <SOCK>)
{
print STDOUT $line;
}
close (SOCK) || die "close: $!";
__END__
The default whois server is whois.internic.net however you can supply
one of your own with the -h parameter - these are a few of the most
common :
American Registry for Internet Numbers - whois.arin.net
European IP Address Allocations - whois.ripe.net
Asia Pacific IP Address Allocations - whois.apnic.net
US Military - whois.nic.mil
US Government - whois.nic.gov
Of course there is a Net::Whois module but as far as I can determine it
doesnt deal real well with the (IMHO) superior RIPE format for
whois database that is used by everyone bar the US. Of course I might
be wrong. Anyhow its quicker to type this code than download and
install the module ;-P
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 9 May 1999 22:30:44 GMT
From: gt4530e@acmex.gatech.edu (Rahim Aladin)
Subject: undefined statements in perl??
Message-Id: <7h52ak$9fe@catapult.gatech.edu>
if you have the following C code:
int i=2, n=10;
i=i++;
n=i++ * i++;
the last two statements are undefined because i is being modified twice in
the same statement. The ANSI/ISO C standard explains this by stating the
following:
"Between the previous and next sequence piont an object shall have its
stored value modified at most once by the evaluation of an expression.
Furthermore, the prior value shall be accessed only to determine the value
to be stored."
What are Perl's rules for situations like this?? I've looked in a few Perl
books and cant find the the answer? Could somebody give me the answer to
this question???
thanks
--
-------------------------------------------------------
Rahim Aladin
gt4530e@prism.gatech.edu
Georgia Institute of Technology, Atlanta Georgia, 30332
-------------------------------------------------------
------------------------------
Date: Sun, 09 May 1999 20:21:20 GMT
From: witte_j@denison.edu
Subject: Web form "debugger" for MacPerl
Message-Id: <7h4qnu$q9a$1@nnrp1.deja.com>
Hello,
Is there a program (or rather simple way) to give data to a MacPerl script
in the form it would come from a web form, for purposes of testing and
debugging form-processing scripts?
Thanks,
Jim Witte
witte_j@denison.edu
Denison University
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 9 May 1999 22:41:42 GMT
From: gt4530e@acmex.gatech.edu (Rahim Aladin)
Subject: what does the following do?
Message-Id: <7h52v6$9fe@catapult.gatech.edu>
my($x, $y, $z) = (1,2,3);
(($x=$y) = $z);
($x = ($y = $z));
ok, i know the last two statements are both valid, but could someone tell
me what each of the last two statments actually do?? what is actually
going on in the two statements??
thanks
--
-------------------------------------------------------
Rahim Aladin
gt4530e@prism.gatech.edu
Georgia Institute of Technology, Atlanta Georgia, 30332
-------------------------------------------------------
------------------------------
Date: 9 May 1999 18:02:08 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Why does NT server return the actual script, not the print items.
Message-Id: <7h4ij1$5l2$1@gellyfish.btinternet.com>
On Sun, 09 May 1999 14:24:48 GMT R. S. wrote:
>
> BTW This is the first time posting to this group.
>
And you didnt think we/I knew that already :
gellyfish@gellyfish:/var/spool/news/comp/lang/perl/misc > grep "From:.*rstacy@nf.sympatico.ca" *
50146:From: rstacy@nf.sympatico.ca (R. S.)
50166:From: rstacy@nf.sympatico.ca (R. S.)
50185:From: rstacy@nf.sympatico.ca (R. S.)
He he he.
Nothing escapes us ;-}
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 5614
**************************************