[13549] in Perl-Users-Digest
Perl-Users Digest, Issue: 959 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 30 23:07:08 1999
Date: Thu, 30 Sep 1999 20:05:08 -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: <938747108-v9-i959@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 30 Sep 1999 Volume: 9 Number: 959
Today's topics:
Re: a question of buttons <grrr@grrr.net>
Re: array getting in the way of compilation <garyg@gator.net>
Re: Bye Tom? (WAS: Re: injecting "my" varibales into ca <elaine@chaos.wustl.edu>
Re: Bye Tom? (WAS: Re: injecting "my" varibales into ca (Martien Verbruggen)
Re: Bye Tom? (WAS: Re: injecting "my" varibales into ca <gleeson@unimelb.edu.au>
Re: Help: Subroutines in Perl (Larry Rosler)
How to list values of all variables during program exec (TGarner5)
Re: How to print to a printer? <elaine@chaos.wustl.edu>
How to retreive the size of a directory on NT <s5dw@telecom.co.nz>
Re: Install CPAN module in ActiveState Windows version <mpersico@erols.com>
ping script to page mobile... (jakal)
Re: Regex & URL parsing... <garyg@gator.net>
Re: RegEx for html->plain text samredman@my-deja.com
Re: RegEx for html->plain text sam@samredman.com
Re: Reversing records in a fixed length file. (jakal)
Re: Reversing records in a fixed length file. (Martien Verbruggen)
Server emulation offline <mattmich@idirect.com>
Re: Server emulation offline <jkline@one.net>
setpwent <rockie@apk.net>
Re: setpwent (Martien Verbruggen)
Re: setpwent <rockie@apk.net>
Re: Sorting weird numeric data <bwalton@rochester.rr.com>
Re: Sorting weird numeric data (Larry Rosler)
SSH module for Win32 <carvdawg@patriot.net>
Re: using CPAN to upgrade perl version <elaine@chaos.wustl.edu>
Re: Wrong value returned when accessing list using scal <skilchen@swissonline.ch>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 30 Sep 1999 17:12:29 -0700
From: Grrr <grrr@grrr.net>
Subject: Re: a question of buttons
Message-Id: <37F3FC6D.919D9286@grrr.net>
"David H. Adler" wrote:
> Herein lies the problem. That is *NOT* the purpose of "these
> newsgroups" (certainly not *this* newsgroup). You might want to do
> some reading in news.announce.newusers if you actually believe that.
Ignorance knows no age group. :}
Also from the diplomatic Mr. Schwartz:
> Thank you, Jason. I got get sufficient replies here, and so I saw
> no need to take the question anywhere else.
Take notice. Don't feed the trolls.
< grrr >
------------------------------
Date: Thu, 30 Sep 1999 22:41:24 -0400
From: "Gary M. Greenberg" <garyg@gator.net>
Subject: Re: array getting in the way of compilation
Message-Id: <37F41F53.91CDB94B@gator.net>
shaun.coon wrote:
>
> I'm writing a piece of code that is meant to circulate through a list of
> data, and place chunks of it into a group of arrays (based on a fairly
> simple alphabetical criteria). I've done this with a set of elsif
> statements following the initial if.
Iterating thru an array creating clustered datasets screams for a hash.
if (exists $list{$k}) {
$list{$k} .= ",".$section[$k];
} else {
$list{$k} = $section[$k];
}
Or, is that not what you're after?
Cheers,
Gary
-=- Avenue Programmers' Reference -=-
Class Hierarchy, Requests, and Hyperlinked Sample Scripts:
http:/www.gator.net/~garyg/aveclass.htm
------------------------------
Date: Thu, 30 Sep 1999 21:15:12 -0400
From: Elaine -HFB- Ashton <elaine@chaos.wustl.edu>
Subject: Re: Bye Tom? (WAS: Re: injecting "my" varibales into callers scope)
Message-Id: <37F40AF4.3C80DAA6@chaos.wustl.edu>
"Paul J. Lucas" wrote:
> Since when does Tom deserve decency?
Since he has given so much of his time to help make Perl what it is.
Granted, he may be an abrasive pain in the ass somedays, but can't
everyone? If I had a nickel for every jerk-off answer in the newsgroup
and similarly debited a dollar for every sane response, I'd still be in
the black.
Read your docs and get a freaking backbone people.
*sigh*
e.
------------------------------
Date: Fri, 01 Oct 1999 01:37:39 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Bye Tom? (WAS: Re: injecting "my" varibales into callers scope)
Message-Id: <DfUI3.104$Fy1.4204@nsw.nnrp.telstra.net>
On Thu, 30 Sep 1999 15:54:18 GMT,
Scratchie <AgitatorsBand@yahoo.com> wrote:
> David Cassell <cassell@mail.cor.epa.gov> wrote:
> :> Since when does Tom deserve decency?
>
> : Since people like you have been driving him nuts, ignoring
> : the thousands and thousands of person-hours of work he has
> : put into the FAQ and the docs and the free scripts and the
> : free modules and the Perl code and the Perl advocacy and
> : everything else he has contributed to this NG and to Perl
> : over the years.
>
> Cry me a river. I appreciate the work Tom has put into documenting Perl,
> but he's rarely been less than a pompous ass in this newsgroup. If he's
> upset by the fact that ignorant people are, well, ignorant, that's his
> problem, and it doesn't exempt him from the standard rules of civilized
> discourse.
One thing this thread is very useful for is for the expansion of my
Score file. It's getting bigger. And the scores are not positive.
Martien
--
Martien Verbruggen |
Interactive Media Division | Think of the average person. Half of
Commercial Dynamics Pty. Ltd. | the people out there are dumber.
NSW, Australia |
------------------------------
Date: Fri, 01 Oct 1999 12:25:43 +1000
From: Martin Gleeson <gleeson@unimelb.edu.au>
Subject: Re: Bye Tom? (WAS: Re: injecting "my" varibales into callers scope)
Message-Id: <011019991225430567%gleeson@unimelb.edu.au>
In article <37f2ab3b$0$219@nntp1.ba.best.com>, Paul J. Lucas <pjl@fuckoff.com>
wrote:
> In <slrn7v56b3.3d2.*@dragons.duesouth.net> *@dragons.duesouth.net (Matthew Bafford) writes:
>
> >Once upon a time (29 Sep 1999 22:27:59 GMT), Paul J. Lucas"
> ><pjl@best.com> was attempting to figure out Ilya's new Perl
> >regex features, and accidently sent the following to
> >comp.lang.perl.misc:
> >: In <slrn7uuk78.k8j.*@dragons.duesouth.net> *@dragons.duesouth.net (Matthew Bafford) writes:
> >: > we'll miss you.
> >: > [tom]
> >:
> >: I won't. How can anybody think he's NOT a major asshole?
> >: He seems like an angry, bitter little man.
>
> >You know, I almost put `most of us will miss you', but, although true,
> >that isn't exactly as nice a thing to say. Anyway, I figured the
> >non-most people would have the sense and decency to keep their fingers
> >away from the keyboard.
>
> Since when does Tom deserve decency?
Why don't you tell us, Mr pjl@fuckoff.com?
You are obviously the authority on the subject.
Cheers,
Marty.
--
Martin Gleeson ... __o
<http://www.unimelb.edu.au/%7Egleeson/> ... -\<,
Webmaster, The University of Melbourne, Australia. ....(_)/(_)..
------------------------------
Date: Thu, 30 Sep 1999 19:08:19 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Help: Subroutines in Perl
Message-Id: <MPG.125db1f340f6a40198a017@nntp.hpl.hp.com>
In article <37F40147.D78DF720@cisco.com> on Thu, 30 Sep 1999 17:33:11 -
0700, Makarand Kulkarni <makkulka@cisco.com> says...
> [ Michael Dartt wrote:
>
> > 1) How do I pass an array to a subroutine?
>
> Pass a reference to it
That is an acceptable way. Another way is to pass the array itself in
the argument list. Dogmatic statements without justification are
irresponsible.
> > Here's some code I've tried:
> > # Returns true if the given num is in the given list
> > sub numIsIn (\@$) {
> > my @array = $_[0];
>
> Derefernce $_[0] like this : my @array = @$_[0] ;
Off the top of your head again, Makarand?
Unless $_ happens to be a reference to the very same array that $_[0]
refers to, and that array has exactly one element, that isnt going to
work. At all.
my @array = @{$_[0]};
And in all the other places where you got it wrong.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 01 Oct 1999 02:45:05 GMT
From: tgarner5@cs.com (TGarner5)
Subject: How to list values of all variables during program execution?
Message-Id: <19990930224505.24181.00000384@ng-ca1.news.cs.com>
How do you "suspend" a script and see the value of all memory variables or a
specific variable during script execution?
------------------------------
Date: Thu, 30 Sep 1999 21:11:20 -0400
From: Elaine -HFB- Ashton <elaine@chaos.wustl.edu>
Subject: Re: How to print to a printer?
Message-Id: <37F40A0C.839B205A@chaos.wustl.edu>
"M.E." wrote:
> I need to be able to print a file from a linux box to a printer.
I would suggest "man lp or man lpr" depending on which demented form of
torture you have.
> I'd appreciate any help or links to help that anyone can give me.
It might help if you read the man pages for your system since printing
has nothing to do with perl other than print $foo; or exec-ing a system
command like lpr.
e.
------------------------------
Date: 1 Oct 1999 01:32:49 GMT
From: "s5dw" <s5dw@telecom.co.nz>
Subject: How to retreive the size of a directory on NT
Message-Id: <01bf0bac$af1ae8c0$66cfab92@TC030114>
Hi,
Is there an easy way to get the size of a directory without adding up the
size of all the files in that directory.
Thanks
Steve
------------------------------
Date: Thu, 30 Sep 1999 22:01:47 -0400
From: "Matthew O. Persico" <mpersico@erols.com>
Subject: Re: Install CPAN module in ActiveState Windows version of Perl?
Message-Id: <37F4160B.3FAAD5E2@erols.com>
Jonathan Stowe wrote:
>
> There are other PPM repositories available and these are configurable
> within the PPM program - I'm afraid I can t remember the URL of any
> at the moment but you might want to inquire of one of the mailing lists
> that are referenced on the Activestate site.
>
> If a module has no XS components then you might be able to install it
> if you obtain 'nmake' (microsofts make utility) which is available from
> microsofts ftp server.
The PPM FAQ that comes with AS covers this.
--
Matthew O. Persico
"Tell me Larry, what part of this newsgroup _is_ in good taste?" -
Elaine -HFB- Ashton <elaine@chaos.wustl.edu> in comp.lang.perl.misc
------------------------------
Date: Fri, 01 Oct 1999 11:24:34 +0930
From: jakem@camtech.net.au (jakal)
Subject: ping script to page mobile...
Message-Id: <jakem-0110991124340001@dialup-sa-1-475.uni.camtech.net.au>
Has anyone written a Perl script that will ping a server, any page a
mobile if the server is down?
jakal
--
jakal
------------------------------
Date: Thu, 30 Sep 1999 21:47:24 -0400
From: "Gary M. Greenberg" <garyg@gator.net>
Subject: Re: Regex & URL parsing...
Message-Id: <37F412AC.31EE08CE@gator.net>
Abigail wrote:
> $text =~ s<
> (?:http://(?:(?:(?:(?:(?:[a-zA-Z\d](?:(?:[a-zA-Z\d]|-)*[a-zA-Z\d])?)\.
...
> !*'(),]|(?:%[a-fA-F\d]{2}))|[;?&=])*)(?::(?:(?:(?:[a-zA-Z\d$\-_.+!*'()
...
> \$\-_.!~*'(),])|(?:%[a-fA-F\d]{2})|[:@&=+])*))*)?)))
> >
> {<a href = "$&">$&</a>}xg;
>
> Abigail
Does that come with a mop?, 'cause I pissed the floor from laughing
so hard. ;p
Gary
------------------------------
Date: Fri, 01 Oct 1999 01:09:20 GMT
From: samredman@my-deja.com
Subject: Re: RegEx for html->plain text
Message-Id: <7t11jp$v8s$1@nnrp1.deja.com>
Check out this link. This guy has done some work in this area and
has some routines that relate specifically although the author claims
them to be a "crude" effort.
Maybe there are others, I am interested in this also.
http://starship.python.net/crew/tibs/python.html
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 01 Oct 1999 01:15:05 GMT
From: sam@samredman.com
Subject: Re: RegEx for html->plain text
Message-Id: <7t11uf$vcs$1@nnrp1.deja.com>
Check out this link. This guy has done some work in this area and
has some routines that relate specifically although the author claims
them to be a "crude" effort.
Maybe there are others, I am interested in this also.
http://starship.python.net/crew/tibs/python.html
my email is sam@samredman.com
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 01 Oct 1999 11:49:48 +0930
From: jakem@camtech.net.au (jakal)
Subject: Re: Reversing records in a fixed length file.
Message-Id: <jakem-0110991149480001@dialup-sa-1-475.uni.camtech.net.au>
In article <Ak4I3.345$8J6.200238@c01read03-admin.service.talkway.com>,
"joneill" <joneill@pgicompanies.com> wrote:
> I wrote a program to reverse records in a fixed length file.
> eg.-
>
> 0001
> 0002
> 0003
> 0004
>
> to
>
> 0004
> 0003
> 0002
> 0001
>
> I am currently using a seek/read combination like this:
>
> $counter = 0;
> $pos = (-s,$inputFile); # to keep track of position in file
> seek(INFILE,-$recLength,2); # get a starting position in the file
> while ($pos)
> {
> if ($counter){ seek(INPUT,-($recordLength * 2),1) }
> read(INPUT,$recordString,$recordLength);
>
> print REVERSED $recordString;
>
> $pos -= $recordLength;
> $counter++;
> }
>
> I believe the program's performance can be improved, but don't know how
> to it. How can it be optimized?
>
Don't know if this helps, but couldn't this do the same thing:
# open the file
(open(FILE,"$file")) || die "can't open $file!";
# load the records in to an array
@records=<FILE>;
# close the file
close(FILE);
# reverse the array
@reverse_records=reverse(@records);
chomp(@reverse_records);
# create output file
(open(OUT,">$outfile")) || die "can't open $outfile!";
# output the reversed records to the out file
foreach $record (@reverse_records)
{
print OUT "$record\n";
}
# close the out file
close(OUT);
--
jakal
------------------------------
Date: Fri, 01 Oct 1999 02:59:00 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Reversing records in a fixed length file.
Message-Id: <UrVI3.128$Fy1.5034@nsw.nnrp.telstra.net>
On Fri, 01 Oct 1999 11:49:48 +0930,
jakal <jakem@camtech.net.au> wrote:
> In article <Ak4I3.345$8J6.200238@c01read03-admin.service.talkway.com>,
> "joneill" <joneill@pgicompanies.com> wrote:
>
> > I wrote a program to reverse records in a fixed length file.
[snip]
> > I believe the program's performance can be improved, but don't know how
> > to it. How can it be optimized?
>
> Don't know if this helps, but couldn't this do the same thing:
A few remarks:
> # open the file
> (open(FILE,"$file")) || die "can't open $file!";
^ ^ ^ ^
| No need |
| for |
| quotes |
Or these brackets
good that you check for an error, but it would be helpful to include
$! in the error message.
> # load the records in to an array
> @records=<FILE>;
>
> # close the file
> close(FILE);
>
> # reverse the array
> @reverse_records=reverse(@records);
> chomp(@reverse_records);
Why do you chomp the record separators, and then add them back later?
This is not necessary.
> # create output file
> (open(OUT,">$outfile")) || die "can't open $outfile!";
Again, no need for the brackets, and $! would be helpful.
> # output the reversed records to the out file
> foreach $record (@reverse_records)
> {
> print OUT "$record\n";
> }
> # close the out file
> close(OUT);
A slightly more compact way might be something like:
#!/usr/local/bin/perl -w
use strict;
my $infile = shift;
my $outfile = shift;
open(IN, $infile) || die "Cannot open $infile for read: $!";
open(OUT, ">$outfile") || die "Cannot open $outfile for write: $!";
print OUT reverse <IN>;
close(OUT);
close(IN);
Note that this approach only works, and is efficient, if the input
file is not too large. It basically will need to read the whole file
into memory.
# perl -e 'print reverse <>' infile > outfile
Martien
--
Martien Verbruggen |
Interactive Media Division | You can't have everything, where would
Commercial Dynamics Pty. Ltd. | you put it?
NSW, Australia |
------------------------------
Date: Fri, 01 Oct 1999 01:10:22 GMT
From: "Matt & Michelle" <mattmich@idirect.com>
Subject: Server emulation offline
Message-Id: <2STI3.17916$fp1.206080@quark.idirect.com>
Hi, I am a brand new newbie.
I would like to beable to run my cgi/perl programs offline when working on
my webpage. I need to know what to install to get my computer to run my
offline webpage as if it were running off a server. I have installed
Standard Perl 5.004.
Thank you in advance
Matt
------------------------------
Date: Thu, 30 Sep 1999 22:09:04 -0400
From: Joe Kline <jkline@one.net>
To: Matt & Michelle <mattmich@idirect.com>
Subject: Re: Server emulation offline
Message-Id: <37F417BF.3B4F26E6@one.net>
[posted and mailed]
Matt & Michelle wrote:
>
> Hi, I am a brand new newbie.
I am a brand X old lurker...
> I would like to beable to run my cgi/perl programs offline when working on
> my webpage. I need to know what to install to get my computer to run my
> offline webpage as if it were running off a server. I have installed
> Standard Perl 5.004.
Well, since this is a Perl newsgroup and not really a web server
group...I guess I will do what I can.
First, you might want to get a hold of Perl version 5.005_03. Lots of
good stuff not found in 5.004.
In any case if you write your CGI script using Perl (note CGI != Perl)
and use CGI.pm then you can do some off-line work.
Or you can decide to write a web server in Perl, to keep in spirit of
this being a Perl newsgroup.
Or you can download a web server. Apache is a good choice, it is
available for both Un*x and Windows.
Or you can go to a newsgroup that deals specifically with CGI scripts
and/or web servers.
joe
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Thu, 30 Sep 1999 22:23:24 -0300
From: "R. Brockway" <rockie@apk.net>
Subject: setpwent
Message-Id: <37F40D0C.1A162ED3@apk.net>
Having trouble finding a good how-to on using setpwent.
http://www.perl.com/pub/doc/manual/html/pod/perlfunc/setpwent.html is
useless and could not find anything via perldoc, nor is it covered in
any of the perl resource kits. I simply am writing some routines that
after they collect info with getpw, some of the fields are modified (ex.
gecos string) and then modified with setpwent. Anyone ever use this
function before with success? Thank you.
-rockie
------------------------------
Date: Fri, 01 Oct 1999 02:43:01 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: setpwent
Message-Id: <VcVI3.119$Fy1.5034@nsw.nnrp.telstra.net>
On Thu, 30 Sep 1999 22:23:24 -0300,
R. Brockway <rockie@apk.net> wrote:
> Having trouble finding a good how-to on using setpwent.
> http://www.perl.com/pub/doc/manual/html/pod/perlfunc/setpwent.html is
# perldoc -f setpwent
This tells you that most of these functions are basically the same as
the system calls on your system
# man setpwent
should therefore give you more information. All you need to do is
translate the C-isms to Perl-isms :)
Martien
--
Martien Verbruggen |
Interactive Media Division | The world is complex; sendmail.cf
Commercial Dynamics Pty. Ltd. | reflects this.
NSW, Australia |
------------------------------
Date: Thu, 30 Sep 1999 22:56:14 -0300
From: "R. Brockway" <rockie@apk.net>
Subject: Re: setpwent
Message-Id: <37F414BD.F7004501@apk.net>
Martien Verbruggen wrote:
> On Thu, 30 Sep 1999 22:23:24 -0300,
> R. Brockway <rockie@apk.net> wrote:
> > Having trouble finding a good how-to on using setpwent.
> > http://www.perl.com/pub/doc/manual/html/pod/perlfunc/setpwent.html is
>
> # perldoc -f setpwent
> This tells you that most of these functions are basically the same as
> the system calls on your system
>
> # man setpwent
> should therefore give you more information. All you need to do is
> translate the C-isms to Perl-isms :)
which then tells me i'm going about this all wrong, as setpwent will only
set or reset the emuneration relative to the password file (position), not
actually have the ability to set fields in the passwd entry. usermod
(solaris) does not have an option (at least documented) to modify the gecos
string and we have seen that sudo passwd -g rarely, but occasionally does
not free up the passwd file. looking for another way to change gecos
fields.
thanks.
-rockie
------------------------------
Date: Thu, 30 Sep 1999 21:24:18 -0400
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Sorting weird numeric data
Message-Id: <37F40D42.94380277@rochester.rr.com>
Abigail wrote:
>
> Bob Walton (bwalton@rochester.rr.com) wrote on MMCCXXI September MCMXCIII
> in <URL:news:37F2E093.6F7243B9@rochester.rr.com>:
> // Larry Rosler wrote:
> // ...
> // > > Oh? Your sorting algorithm beats O (N log N)?
> //
> // The following program will sort the input we are discussing
> // (items of the form 1.2.3.4) in O(N). Why is it folks consider
> // the best sort that can be done to require O(N logN) operations?
>
> Not so fast. Your algorithm seems to be Omega (U + S * N), where U and S
> are dependent on the data. If I give you the list
>
> map {$_ * $_ * $_} 1 .. $N
>
> to sort, your algorithm takes Omega (N^3).
>
> Another fun list to sort is:
>
> 1 x $N, 1 . ".0" x $N
>
> which takes Omega (N^2).
>
> [ Adaption of counting sort snipped ]
>
> Counting sort only beats O (N log N) by making extra assumptions.
> Assumptions we were not making here.
Well, let's discuss the sorting of strings. If a string is defined
as a finite sequence of unsigned integers ranging in value from 0
to 255, the sort I propose needs 256 bins. It does need to
make "m" passes, where "m" is the length of the second-longest
string plus 1, or the longest string, whichever is largest. But
any sort that compares strings can be stated to be of order "m"
times whatever the sort would have been could the comparison be
done without the potential necessity to examine "m" characters
per comparison (meaning a "traditional" string sort is actually
O(m N logN) if that is how we are going to count things). In
this case, the sort I propose would be O(m N 256), or, in other
words, O(m N), and, thus, for a given maximum length of string,
O(N). If one can obtain a sort of O(N) by making some assumptions
that are actually present anyway, why the resistance to the idea?
And note that the data for most any sort comparison can be
pack'ed into strings for comparison purposes (there was even a
discussion of how to do that for floating point data in this
thread). Therefore, most any sort could be performed O(N).
>
> And yes, I know everything about Perl being limited to 32 bits.
> Let's not go that way.
>
> Abigail
> --
> %0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
> (.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi
>
> -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
> http://www.newsfeeds.com The Largest Usenet Servers in the World!
> ------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Thu, 30 Sep 1999 19:22:34 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Sorting weird numeric data
Message-Id: <MPG.125dbac14cbf4f9698a018@nntp.hpl.hp.com>
In article <37F40D42.94380277@rochester.rr.com> on Thu, 30 Sep 1999
21:24:18 -0400, Bob Walton <bwalton@rochester.rr.com> says...
...
> ... If one can obtain a sort of O(N) by making some assumptions
> that are actually present anyway, why the resistance to the idea?
> And note that the data for most any sort comparison can be
> pack'ed into strings for comparison purposes (there was even a
> discussion of how to do that for floating point data in this
> thread). Therefore, most any sort could be performed O(N).
Who is resistant to the idea? All you have to do is to post a
demonstration of your method, with benchmarks that show O(N) behavior
over several decades of N. Your data can consist of lists of arbitrary
strings of reasonable length, say a few dozen characters each.
If enough of us find the results persuasive, we will surely be willing
to nominate you for the Turing Award.
Deal?
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 30 Sep 1999 21:32:09 -0400
From: "Harlan Carvey, CISSP" <carvdawg@patriot.net>
Subject: SSH module for Win32
Message-Id: <37F40F19.46940264@patriot.net>
Has anyone seen a module to do ssh on Win32...just the client stuff?
I've checked ActiveState, CPAN, and some other sites....if anyone
knows of one, I'd appreciate it...
thanks
Carv
------------------------------
Date: Thu, 30 Sep 1999 21:07:28 -0400
From: Elaine -HFB- Ashton <elaine@chaos.wustl.edu>
Subject: Re: using CPAN to upgrade perl version
Message-Id: <37F40925.F5F59CE5@chaos.wustl.edu>
Danny Aldham wrote:
> I am not sure I would want to, but is it possible to use the CPAN module
> to actually upgrade the version of perl running?
DESCRIPTION
The CPAN module is designed to automate the make and install
of perl modules and extensions. It includes some searching
capabilities and knows how to use Net::FTP or LWP (or lynx
or an external ftp client) to fetch the raw data from the
net.
cpan> install perl
Warning: Cannot install perl, don't know what it is.
Try the command
i /perl/
to find objects with similar identifiers.
Perl isn't a module, ergo, the answer is no.
e.
------------------------------
Date: Fri, 01 Oct 1999 01:19:10 GMT
From: "Samuel Kilchenmann" <skilchen@swissonline.ch>
Subject: Re: Wrong value returned when accessing list using scalar variable?
Message-Id: <i_TI3.20728$m4.79294908@news.magma.ca>
<geotekjohn@my-deja.com> schrieb in im Newsbeitrag:
7t0mcn$n9b$1@nnrp1.deja.com...
>
> # $col_index = a mod b Since there is no MOD function in
> perl, I implemented one myself.
But Perl has the % operator: From perldoc perlop
Binary "%" computes the modulus of two numbers. Given integer
operands `$a' and `$b': If `$b' is positive, then `$a % $b' is
`$a' minus the largest multiple of `$b' that is not greater than
`$a'. If `$b' is negative, then `$a % $b' is `$a' minus the
smallest multiple of `$b' that is not less than `$a' (i.e. the
result will be less than or equal to zero). Note than when `use
integer' is in scope, "%" give you direct access to the modulus
operator as implemented by your C compiler. This operator is not
as well defined for negative operands, but it will execute
faster.
> if (($a/$b) < 1)
> {
> $col_index = $a;
> }
> else
> {
> # print "a = $a \t b = $b";
> $col_index = abs((int ($a/$b) - ($a/$b)) * $b);
> }
>
Thats not a good MOD emulation because of the floating point arithmetic
involved.
In your "problem case" $col_index = abs((int(4/3) - (4/3)) * 3); seems
to be 1 but if you add a line like
print $col_index - 1;
you will get something like:
-2.22044604925031e-016
so $col_index is a little bit smaller than 1. As it seems,
floating-point indexes into arrays are rounded to zero, that's why you
get the "wrong" output:
> Row index = 1 Col index = 1
> &RowValue=row1&ColumnValue=col0 <--- Why is this col0 ?? Should be
col1
A "better" emulation of a remainder function would be:
(its still not good, because of the wonders of floating point
arithmetic, but infact the builtin % operator isn't much better, except
that it implements the modulo function and not the remainder function -
as defined e.g. in R5RS)
sub remainder {
my($x, $y) = @_;
return $x - int($x / $y) * $y;
}
(ps: please don't use tabs in usenet postings because they are
nonportable, see your code above)
------------------------------
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 959
*************************************