[22474] in Perl-Users-Digest
Perl-Users Digest, Issue: 4695 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 11 14:11:36 2003
Date: Tue, 11 Mar 2003 11:10:12 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 11 Mar 2003 Volume: 10 Number: 4695
Today's topics:
Re: Re to all <me@privacy.net>
Re: Re to all <noreply@gunnar.cc>
Re: Re to all (Helgi Briem)
Re: Re to all <noreply@gunnar.cc>
Re: Re to all <humrattle@hotmail.com>
RTF::Parser (Pete Sergeant)
Re: select ip-adress out of pipe delimited file <perl-dvd@darklaser.com>
Re: Slow garbage collection of bigass hash? (Sara)
Re: Sorting array of hash references by a hash key <tore@aursand.no>
sorting woes <johannes.fuernkranz@t-online.de>
Re: sorting woes <bigj@kamelfreund.de>
Re: sorting woes <usenet@dwall.fastmail.fm>
Re: sorting woes <me@verizon.invalid>
Re: sorting woes <johannes.fuernkranz@t-online.de>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 11 Mar 2003 22:44:10 +1100
From: "Tintin" <me@privacy.net>
Subject: Re: Re to all
Message-Id: <b4ki6c$2063et$1@ID-172104.news.dfncis.de>
"Gunnar Hjalmarsson" <noreply@gunnar.cc> wrote in message
news:b4j66f$207d3n$1@ID-184292.news.dfncis.de...
> Tintin wrote:
> > I would find it very difficult to believe that you do all your
> > development via FTP. How the hell do you manage to edit the file
> > with FTP?
>
> Even if that comment was not directed to me, I have to say that I find
> it very insulting. Any particular reason not to take the poster's word
> for it??
You've taken it the wrong way. It was meant to jolt the OP into thinking
that their description is confused and/or there is a better way of achieving
the results.
------------------------------
Date: Tue, 11 Mar 2003 13:48:48 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Re to all
Message-Id: <b4kluk$2143va$1@ID-184292.news.dfncis.de>
Tintin wrote:
> "Gunnar Hjalmarsson" <noreply@gunnar.cc> wrote in message
> news:b4j66f$207d3n$1@ID-184292.news.dfncis.de...
>
>>Tintin wrote:
>>
>>>I would find it very difficult to believe that you do all your
>>>development via FTP. How the hell do you manage to edit the file
>>>with FTP?
>>
>>Even if that comment was not directed to me, I have to say that I find
>>it very insulting. Any particular reason not to take the poster's word
>>for it??
>
> You've taken it the wrong way. It was meant to jolt the OP into thinking
> that their description is confused and/or there is a better way of achieving
> the results.
Well, I didn't find OP's reply to Jürgen confused. The fact that there
are better ways to do it is quite another thing IMO.
To me, "I don't believe" is equal to "I think that you are not telling
me the truth", and "I find it difficult to believe" is equal to "I doubt
that you are telling me the truth". (Note that English isn't my native
language.) Anyway, I'm relieved to hear that I took it the wrong way. My
apologies for that.
Some posts in this group are unnecessarily patronizing to beginners IMO.
You'd better see my reaction in the light of that.
/ Gunnar
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Tue, 11 Mar 2003 13:16:37 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: Re to all
Message-Id: <3e6de09e.2769897011@news.cis.dfn.de>
On Tue, 11 Mar 2003 13:48:48 +0100, Gunnar Hjalmarsson
<noreply@gunnar.cc> wrote:
>To me, "I don't believe" is equal to "I think that you are not telling
>me the truth", and "I find it difficult to believe" is equal to "I doubt
>that you are telling me the truth".
Not at all.
That is a very idiosyncratic way of understanding a common
English phrase, Gunnar. If you are going to participitate
in discussions in English you should get rid of this
misunderstanding.
"I don't believe you did X" generally means something like
"Doing X is strange and unusual and probably a mistake on
your part." "I find it difficult to believe" means
roughly the same, but less strongly.
--
Regards, Helgi Briem
helgi AT decode DOT is
------------------------------
Date: Tue, 11 Mar 2003 15:24:46 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Re to all
Message-Id: <b4krii$1vgd62$1@ID-184292.news.dfncis.de>
Helgi Briem wrote:
> On Tue, 11 Mar 2003 13:48:48 +0100, Gunnar Hjalmarsson
> <noreply@gunnar.cc> wrote:
>
>>To me, "I don't believe" is equal to "I think that you are not telling
>>me the truth", and "I find it difficult to believe" is equal to "I doubt
>>that you are telling me the truth".
>
> Not at all.
>
> That is a very idiosyncratic way of understanding a common
> English phrase, Gunnar. If you are going to participitate
> in discussions in English you should get rid of this
> misunderstanding.
>
> "I don't believe you did X" generally means something like
> "Doing X is strange and unusual and probably a mistake on
> your part." "I find it difficult to believe" means
> roughly the same, but less strongly.
Okay, thanks for the English lesson, Helgi. I'll try to keep your
'decoding' of those expressions in mind. ;-)
/ Gunnar
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Tue, 11 Mar 2003 18:38:51 +0100
From: "Hum Rattle" <humrattle@hotmail.com>
Subject: Re: Re to all
Message-Id: <b4l6um$2031eh$1@ID-63849.news.dfncis.de>
Hi jue
"Jürgen Exner" <jurgenex@hotmail.com> schrieb im Newsbeitrag
news:Secba.12463$iq1.3444@nwrddc02.gnilink.net...
> How do you access that ftp account? With your ball pen? Or with
> Magic::Transcendent?
with ftp client, you ever heard of? there are a lot of them
you can download for windows!
Also there are a lot of ISP not providing shell access.
i was asked to modify a script which already exist
and i thought that i could manage it without installing
Linux on a machine....I got some error 500 so i just
asked if something was wrong in the loop syntax
the job was just to add a logical operator to the while
loop
> I bet you are using some computer running some OS and on any OS that I
know
> of you have some sort of shell access. La voila, you got your shell
access.
> Where is the problem?
i had a problem at this time, i asked, some answered.
if you feel too smart to answer, just don't do it!
i want to quit this thread here.
thanks to all who tried to help me in some way.
hum
------------------------------
Date: 11 Mar 2003 05:44:53 -0800
From: pete@clueball.com (Pete Sergeant)
Subject: RTF::Parser
Message-Id: <3a0e2fa5.0303110544.57eafd14@posting.google.com>
I'm taking over the maintenance of RTF::Parser, and my plans are to
write hundreds of tests, and some documentation (none currently
exists). I was hoping, therefore, that people could send me code
they'd written using RTF::Parser, on which I can base tests.
Submissions to rtf-parser@clueball.com please.
Thanks!
+Pete
------------------------------
Date: Tue, 11 Mar 2003 15:07:48 GMT
From: "David" <perl-dvd@darklaser.com>
Subject: Re: select ip-adress out of pipe delimited file
Message-Id: <8Zmba.40$Ku2.9672@news-west.eli.net>
"Pynex" <pynex@gmx.de> wrote in message
news:d57585e5.0303102348.3516b74b@posting.google.com...
> Hello !
>
> I've got a pipe delimited file like this:
>
>
456|blob|06-20-2001|ping|09-15-2002|192.168.1.1|ABC-1-01|||Hub|Yes|mid|t
el
>
457|blub|06-20-2000|pang|09-21-2002|192.168.1.2|ABG-1-134|||Hub|Yes|mid|
tel
>
458|bleb|06-20-1999|pung|09-23-2002|192.168.1.3|BGF-1-03|||Hub|Yes|mid|t
el
>
459|blib|06-20-2002|peng|09-25-2002|192.168.1.6|L67-1-87|||Hub|Yes|mid|t
el
>
> I want to get the IP-Adresses.
>
> At the moment i'm doing it in this way (it not very beautiful, but it
works):
>
> $line=<FILE>;
> ($one,$two,$three,$four,$five,$sic,$seven)=split /[|]/, $line,7;
> print "$six\n";
>
> Anybody a better idea ?
Well, using a regex is the most common way (p.s. you've got a type-o, in
your split you called it $sic not $six). You could do something like
this:
$line =~ /^[^\|]*\|[^\|]*\|[^\|]*\|[^\|]*\|[^\|]*\|([^\|]+)\|/;
my $ip = $1; # $1 is equal to the matched value in the ()
Basically what we are doing here is saying,
/^ start from the beginning
[^\|]*\| match 0 or more non | characters until we reach a |
we do this 5 times to match the unwanted first five
values.
([^\|]+)\| match 1 or more non | characters and place that in $1, end
the
value matched at the next | character.
If you wanted to be more picky to make sure the results
were an ip address format, you could replace this part
with
something like this
(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\|
which would force there to be 4 period delimited numbers
which are each between 1 and 3 characters long.
Regards,
David
perl -e'print for map chr$_+1,"111100113107044099117099132"=~/(.{3})/g'
------------------------------
Date: 11 Mar 2003 04:56:41 -0800
From: genericax@hotmail.com (Sara)
Subject: Re: Slow garbage collection of bigass hash?
Message-Id: <776e0325.0303110456.380be77a@posting.google.com>
"Seth Brundle" <brundlefly76@hotmail.com> wrote in message news:<Sggba.201$eb1.12566@typhoon.sonic.net>...
> I have a subroutine which creates a 400MB hash.
>
> I propogate it with about 2.2M key/value pairs, run some ops on it, it works
> fine.
>
> When the hash falls out of scope or when I try to explicitly undef it, or
> try to assign () to it, the program just hangs. It has hung for at least 10
> minutes before I killed it, I've never seen it complete.
>
> I have never seen this behavior from Perl before - then again, I've never
> built a 400MB hash before.
>
> Any ideas?
Is the hash tied? I found similar problems with large tied hashes. I
tried chaching frequent values in a smaller hash, other DBs like GDBM,
and ways to reduce the hash size. Nothing really did the trick. I
moved the ap to mysql and it flies now. Some problems just aren't
suited for hashes. In theory yes, in practice they don't work..
Good luck!
GX
------------------------------
Date: Tue, 11 Mar 2003 15:20:55 +0100
From: "Tore Aursand" <tore@aursand.no>
Subject: Re: Sorting array of hash references by a hash key
Message-Id: <pan.2003.03.11.10.59.50.417283@aursand.no>
On Mon, 10 Mar 2003 23:23:09 -0500, Thomas D wrote:
> is there a way to sort the array by a hash key, eg. key "color"?
'perlfaq -q sort'
'perlfaq -q hash'
--
Tore Aursand <tore@aursand.no>
------------------------------
Date: Tue, 11 Mar 2003 19:08:37 +0100
From: =?ISO-8859-1?Q?Johannes_F=FCrnkranz?= <johannes.fuernkranz@t-online.de>
Subject: sorting woes
Message-Id: <b4l8nb$s3g$00$1@news.t-online.com>
Hi,
I'm sure there is a most trivial bug in this program, but I just can't
find it.
I make a list of $l random numbers, than I make pairs [ $_, $random[$i]
], and then I want to sort this list by the second item.
(I could write this more concisely, of course, but this is part of a
bigger thing).
Can anybody tell me, why it doesn't sort the values (or better why they
get sorted in a weird way?
thanks a million, Juffi
---Code starts here---
use strict;
my $l = 10; # length of list
my @random = map rand, (1..$l);
sub list_sort {
my @h = ();
foreach (0..$l-1) {
push @h, [$_, $random[$_]];
}
return sort { $a->[1] < $b->[1] } @h;
}
map { printf "$_: %5.4f\n", $random[$_] } (0..$l-1);
print "\n";
map { printf "$_->[0]: %5.4f\n", $_->[1] } list_sort;
print "\n";
-----Sample Output starts here----
0: 0.9984
1: 0.1440
2: 0.7390
3: 0.2768
4: 0.2777
5: 0.5814
6: 0.3742
7: 0.4864
8: 0.4866
9: 0.9997
9: 0.9997
0: 0.9984
8: 0.4866
7: 0.4864
6: 0.3742
1: 0.1440
2: 0.7390
3: 0.2768
5: 0.5814
4: 0.2777
------------------------------
Date: Tue, 11 Mar 2003 19:01:08 +0100
From: "Janek Schleicher" <bigj@kamelfreund.de>
Subject: Re: sorting woes
Message-Id: <pan.2003.03.11.18.01.08.474687@kamelfreund.de>
Johannes Fürnkranz wrote at Tue, 11 Mar 2003 19:08:37 +0100:
> I'm sure there is a most trivial bug in this program, but I just can't
> find it.
> [...]
> sub list_sort {
> my @h = ();
> foreach (0..$l-1) {
> push @h, [$_, $random[$_]];
> }
> return sort { $a->[1] < $b->[1] } @h;
^^
You had to write
<>
for the comparison operator instead of only a <.
> }
>
> map { printf "$_: %5.4f\n", $random[$_] } (0..$l-1);
> print "\n";
> map { printf "$_->[0]: %5.4f\n", $_->[1] } list_sort;
> print "\n";
Greetings,
Janek
------------------------------
Date: Tue, 11 Mar 2003 18:42:20 -0000
From: "David K. Wall" <usenet@dwall.fastmail.fm>
Subject: Re: sorting woes
Message-Id: <Xns933B8B6BAEBF9dkwwashere@216.168.3.30>
Johannes Fürnkranz <johannes.fuernkranz@t-online.de> wrote on 11 Mar
2003:
> use strict;
>
> my $l = 10; # length of list
> my @random = map rand, (1..$l);
>
> sub list_sort {
I wonder why you do this as a subroutine instead of just creating a
new, sorted array. Or if it needs to be a sub, why not pass it the
@random array (or a reference to it) instead of assuming @random
exists?
> my @h = ();
> foreach (0..$l-1) {
> push @h, [$_, $random[$_]];
> }
> return sort { $a->[1] < $b->[1] } @h;
Use the "spaceship" operator:
return sort { $a->[1] <=> $b->[1] } @h;
>}
>
> map { printf "$_: %5.4f\n", $random[$_] } (0..$l-1);
> print "\n";
> map { printf "$_->[0]: %5.4f\n", $_->[1] } list_sort;
> print "\n";
--
David K. Wall - usenet@dwall.fastmail.fm
"Oook."
------------------------------
Date: Tue, 11 Mar 2003 18:42:49 GMT
From: "dw" <me@verizon.invalid>
Subject: Re: sorting woes
Message-Id: <J6qba.26043$gi1.13330@nwrdny02.gnilink.net>
"Johannes Fürnkranz" <johannes.fuernkranz@t-online.de> wrote in message
news:b4l8nb$s3g$00$1@news.t-online.com...
> sub list_sort {
> my @h = ();
> foreach (0..$l-1) {
> push @h, [$_, $random[$_]];
> }
> return sort { $a->[1] < $b->[1] } @h;
You need to use <=> instead of < in your call to sort:
return sort { $a->[1] <=> $b->[1] } @h;
> }
>
------------------------------
Date: Tue, 11 Mar 2003 19:53:31 +0100
From: =?ISO-8859-15?Q?Johannes_F=FCrnkranz?= <johannes.fuernkranz@t-online.de>
Subject: Re: sorting woes
Message-Id: <b4lbbd$28n$04$1@news.t-online.com>
Janek Schleicher wrote: ^^
>
> You had to write
> <>
> for the comparison operator instead of only a <.
Oh my god. I can't believe that this cost me almost the whole afternoon...
Thanks, though. :-)
Juffi
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.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 V10 Issue 4695
***************************************