[8771] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 2388 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Apr 22 13:37:31 1998

Date: Wed, 22 Apr 98 10:29:59 -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           Wed, 22 Apr 1998     Volume: 8 Number: 2388

Today's topics:
    Re: Snobby news group (Abby Franquemont)
    Re: Snobby news group (I R A Aggie)
    Re: Snobby news group (I R A Aggie)
    Re: Snobby news group <rjk@coos.dartmouth.edu>
    Re: Snobby news group <elssa09@callisto.si.usherb.ca>
    Re: Snobby news group <uri@sysarch.com>
    Re: Snobby news group (Chris Nandor)
    Re: Snobby news group (Abigail)
    Re: Snobby news group <andrewf@cp.pathfinder.com>
    Re: Snobby news group <keithmur@mindspring.com>
    Re: Snobby news group <ashparbe@indiana.edu>
    Re: Snobby news group <ebohlman@netcom.com>
        Socket Options for Multicast (Mark Mueller)
    Re: Sorting an associative array. <rdschramm@earthlink.net>
    Re: Sorting an associative array. <lr@hpl.hp.com>
    Re: Sorting an associative array. (Martien Verbruggen)
    Re: Sorting Arrays to Numbers (Craig Berry)
        spoiled noobie <sahagian@ziplink.net>
    Re: spoiled noobie <rjk@coos.dartmouth.edu>
    Re: spoiled noobie (Kevin Reid)
        Statistics for comp.lang.perl.misc <gbacon@cs.uah.edu>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 19 Apr 1998 10:45:50 -0700
From: abby@ucan.foad.org (Abby Franquemont)
Subject: Re: Snobby news group
Message-Id: <6hdd8e$siq$1@ucan.foad.org>

In article <3539BAA1.71028B90@renta.net>,
Mark Constable  <markc@renta.net> wrote:
>I R A Aggie wrote:
>> 
>> If they're not willing to put in some effort to figure out their
>> problems, then why should anyone else be expected to put in
>> any more effort than what the questioner has already expended?
>
>Simply because it is not possible for any _NEW_ user to perl
>et al to read every fucking piece of documentation and literature
>all on the first day... that is why. I have spent hours tracking
>down problems, that were NOT explained clearly, in said documentation
>and it is infuriating when you know that someone else who has
>been down this track before would (most likely) know the answer
>in 1 second, or less.

I was in just this situation yesterday. I'd been over a bunch of
things and hadn't found a concrete answer to my question. So, I
posted here asking for help. Within hours, someone answered and
I had much better direction in looking for deeper understanding
of my little issue, as well as an answer to the specific question.

What did I do differently from other posters in this case? I looked
for the answer first, then in my question, said where I'd looked for
the answers and what new questions the things I found had brought
up for me. I posted a paragraph of doc that I wasn't sure how to 
take. I asked for pointers to other docs on the subject.

>I would suggest it more appropriate for the right royal dicks
>that know it all to go elsewhere from a general newsgroup where
>most people would expect to be able to get some help and find
>some support.

I've really seen nothing on the part of regulars here that I
haven't seen in every technical newsgroup I have frequented in
my newsreading career. USENET isn't a free help desk where every
poster with experience is required to provide mannerly solutions
to every question, however inane or off-topic. People reading
clpm are here on their own time -- they should be using that to
answer questions that have already been answered so many times 
that they're in the extremely comprehensive FAQ? 

I personally would prefer that the "right royal dicks who know it
all" be around to answer the really sticky questions... which would
be the ones you don't find answers to in a quick look through the
FAQ or the docs that come with perl.  "How do I get input from STDIN"
or "How do I change a line in a file" or "How do I get HTML out of
this document" are already answered well. "I'm not clear on the 
difference between these two ways of doing something, even after
reading up on both, can someone help me out?" strikes me as a decent
enough beginning question that may not be in the FAQ.

The FAQ is long, sure -- all the more reason to figure odds are that
a given question is in there. There are umpteen trillion man pages,
yes -- and "man perl" tells you which to look at for your situation.
Even if all of that doesn't yield a solution, that still does not
mean everyone is entitled to the benefit of someone else's hard work
and experience, for free. Asking questions here is asking favours.
Who gets pissed off when they ask a stranger for a favour and they
don't want to do it?
-- 
Abby Franquemont        Nothing cures insomnia like the realization 
J. Random BOFH          that it's time to get up. --Fortune program


------------------------------

Date: Sun, 19 Apr 1998 17:11:06 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Snobby news group
Message-Id: <fl_aggie-1904981711070001@aggie.coaps.fsu.edu>

In article <slrn6jii0i.rq0.wendigo@deathstar.jabberwock.org>,
wendigoNO@SPAMpobox.com wrote:

+ I like the idea of comp.lang.perl.help, as for .moderated ... I'd
+ hold off on that until traffic patterns determined if it were necessary.

Oh, it is necessary.

James

-- 
Consulting Minister for Consultants, DNRC
The Bill of Rights is paid in Responsibilities - Jean McGuire
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/CPAN-local/doc/FAQs/cgi/idiots-guide.html>


------------------------------

Date: Sun, 19 Apr 1998 17:17:24 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Snobby news group
Message-Id: <fl_aggie-1904981717250001@aggie.coaps.fsu.edu>

In article <3539BAA1.71028B90@renta.net>, Mark Constable <markc@renta.net>
wrote:

+ I R A Aggie wrote:
+ 
+ > You're mistaken. Badly.
+ > 
+ > The attitude is more accurately stated as "you won't use the index
+ > in a book, you won't search the on-line documentation, you won't
+ > use 'perldoc perlfaq' but instead depend upon some kind-natured
+ > soul on Usenet to answer your question that is answered in the
+ > afore mentioned resources? then you get what you deserve."
+ > 
+ > If they're not willing to put in some effort to figure out their
+ > problems, then why should anyone else be expected to put in
+ > any more effort than what the questioner has already expended?
+ 
+ Simply because it is not possible for any _NEW_ user to perl
+ et al to read every fucking piece of documentation and literature
+ all on the first day... that is why.

Ummm...which part of "index" and "search" indicates that I believe
that anyone should read the complete body of work? I think only
a technical editor or possibly Tom Christiansen has done that.

To coin a phrase "well, duh"...by the way, did you know that there
is a version of the man pages that is in a searchable PDF format.
Saying "I couldn't search the documentation" is NOT an acceptable
answer.

+ I have spent hours tracking
+ down problems, that were NOT explained clearly, in said documentation

Then you where able to phrase a well thought and clearly articulated
question, yes? Something like:

    The docs say 'do X'. I did X with this code, but it does Y instead.
    What is it that I'm missing?

+ and it is infuriating when you know that someone else who has
+ been down this track before would (most likely) know the answer
+ in 1 second, or less.

So, you're saying your well thought and clearly articulated question
got you flamed?

+ I would suggest it more appropriate for the right royal dicks
+ that know it all to go elsewhere from a general newsgroup where
+ most people would expect to be able to get some help and find
+ some support.

With an attitude like that, no wonder you didn't get any help...

James

-- 
Consulting Minister for Consultants, DNRC
The Bill of Rights is paid in Responsibilities - Jean McGuire
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/CPAN-local/doc/FAQs/cgi/idiots-guide.html>


------------------------------

Date: Sun, 19 Apr 1998 17:43:53 -0400
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
Subject: Re: Snobby news group
Message-Id: <353A701D.6BA32023@coos.dartmouth.edu>

Stuart McDow wrote:
> 
> comp.lang.perl.moderated - the "wizards" group, if you will

No, I won't.  I'd be very surprised if any of the proponents of
comp.lang.perl.moderated intend it for "wizards" only.  The moderation would
target FAQs and off-topic posts, not new or inexperienced Perl programmers.

-- 
 _ / '  _      /         - aka -             rjk@coos.dartmouth.edu
( /)//)//)(//)/(    Ronald J. Kimball           chipmunk@m-net.arbornet.org
    /                                   http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


------------------------------

Date: Mon, 20 Apr 1998 02:39:02 GMT
From: ELSS Admin <elssa09@callisto.si.usherb.ca>
Subject: Re: Snobby news group
Message-Id: <33066B20.57F1@callisto.si.usherb.ca>

The only real problem we have here is that some people can't resist
being snarky! Give the newcomers real answers - the reason why they come
here. FAQs are faqs. Tell them about them, sure. But give them a helping
hand too! EVERYONE has to get their start somewhere! If you're not
interested in helping or paid to help ... shut up!

Natalie


------------------------------

Date: 20 Apr 1998 00:03:09 -0400
From: Uri Guttman <uri@sysarch.com>
To: Mark Stackhouse <stackhou@execpc.com>
Subject: Re: Snobby news group
Message-Id: <x7af9hywaq.fsf@sysarch.com>

>>>>> "MS" == Mark Stackhouse <stackhou@execpc.com> writes:

  MS> 	http://www.icparts.com/perlforum/

whta is interseting (and very funny to me) is that the bbs this site is
setting up asks the members to do the VERY same thing this group always
asks of questioners. that is be very specific about your need and ask a
real question, not just HELP ME!

this group asks you to state a problem you are having with perl,
(extremely) preferably with example code. ask a question(s) about it,
like "why does this fail?" or "i don't understand this operator or
function"

the newbie forum states:

<QUOTE>
This brings up the first rule... When querying the BBS, it is imperative
that the querent title his/her message with the book, and page, i.e.;
Learning Perl, Pg. 1, rather than "What does foo mean? Then state what
your having trouble with, in the text of your message.
</QUOTE>

sound familiar? that is the gist of the whole newbie problem. wide open
help requests without real questions and real code examples. the gurus
have no issues answering these type of posts and they will probably get
past the moderator of the new group. it is the "how do i write a
compiler in 1 line of perl with a cgi interface?" that they flame. or
off topic questions better answered in a cgi group. 

they get tired of each new wave of web newbies who hear about "perl" and
how easy it is to write cgi scripts with it and who do NO ground
work. it is not an altar/worship relationship they want but more of a
mentor/protoge relationship with mutual respect. but if you don't
respect the gods (:-) beware their wrath and flames.

hope this clears up this issue,

uri


-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire  ----  8 Years of Perl Experience, Available Immediately
uri@sysarch.com  ---------  Resume and Perl Example at http://www.sysarch.com
Use the Best Search Engine on the Net  --------  http://www.northernlight.com


------------------------------

Date: Mon, 20 Apr 1998 09:02:29 -0400
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Snobby news group
Message-Id: <pudge-2004980902310001@ppp-24.ts-1.kin.idt.net>

In article <6h8cdr$nkk$1@info.uah.edu>, Greg Bacon <gbacon@cs.uah.edu> wrote:

# In article <6h82ft$69c$1@news.scruz.net>,
#         "Database Coder" <dbcoder@juno.com> writes:
# : Why is this such a snobby unhelpful news group. I have posted in many other
# : news groups and always recieved polite and helpful responses. This news
# : group is the exception. The amount of time you people spend asking people if
# : they read the FAQ or bought a good book on PERL could have been spent
# : helping the person.
# 
# It's precisely this sort of attitude that makes those of us in a
# position to answer questions (believe it or not, a lot of us actually
# *enjoy* helping people who are also willing to help themselves) count
# the seconds until we have comp.lang.perl.moderated.  You call it
# snobbery, we call it noise filtration.
# 
# When the new group is in place, I promise never again to bitch about
# someone asking a FAQ on comp.lang.perl.misc. :-)

I don't.  :)

What makes ME mad is that people like me and Randal and you and Tom P. and
Tom C. and dozens of others give our free time, hours and hours a week
sometimes, helping people.  Our free time.  No one pays us to.  We help on
mailing lists, usenet, IRC, e-mail.  If I may borrow from A Few Good Men:

   I have neither the time nor inclination to explain myself to a man who rises 
   and codes under the very blanket of free information that I provide.  I
would 
   rather you said thank you and went on your way.  Otherwise, I suggest you 
   pick up a Camel, and start reading.  Either way, I don't give a damn
what you 
   think.

But on a more practical level, we have no desire to tell people how to
code on Usenet and IRC and mailing lists.  We have a desire to get people
to learn on their own.  Free resources abound.  We point you to them, we
create them.  If you cannot learn from these resources, then you are not
programmer material, period.  So they act as a good way to weed out the
undesirables.  You don't like it?  I am not concerned.

Just now someone on IRC asked how to set a timeout to his connection to a
server.  I asked him several questions, to try to help him.  He refused to
answer me.  He instead just repeated his question.  I warned him that if
he did not give some useful information, he would get kicked from the
channel.  He persisted.  I kicked him.  He came back on and and shouted
"yeah, fuck you too" several times in a row and left.

And yet I still stick around and help people.  You should be amazed that
anyone sticks around to answer questions.  Heck, I have about given up on
clpm, and I applaud people like Randal and Tom P. and others who do stick
around, even those who respond in flames on occasion.  It is a wonder that
they even bother sometimes.  Yet they do.  Send them a thank you next
time, even when they aren't helping you specifically.

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10  1FF7 7F13 8180 B6B6'])
#==               New Book:  MacPerl: Power and Ease               ==#
#==    Publishing Date: Early 1998. http://www.ptf.com/macperl/    ==#


------------------------------

Date: 20 Apr 1998 14:55:21 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Snobby news group
Message-Id: <6hfnkp$dm0$2@client2.news.psi.net>

ELSS Admin (elssa09@callisto.si.usherb.ca) wrote on MDCXCIII September
MCMXCIII in <URL: news:33066B20.57F1@callisto.si.usherb.ca>:
++ The only real problem we have here is that some people can't resist
++ being snarky! Give the newcomers real answers - the reason why they come
++ here. FAQs are faqs. Tell them about them, sure. But give them a helping
++ hand too! EVERYONE has to get their start somewhere! If you're not

That's why we point people to the faq. That's why people wrote a faq.
If that isn't helping people, then what is?

++ interested in helping or paid to help ... shut up!

Fine. You give longy answers to the questions then. See how long
you keep that up. Perhaps you have the time and energy.


Abigail
-- 
perl  -e '$_ = q *4a75737420616e6f74686572205065726c204861636b65720a*;
          for ($*=******;$**=******;$**=******) {$**=*******s*..*qq}
          print chr 0x$& and q
          qq}*excess********}'


------------------------------

Date: Mon, 20 Apr 1998 15:21:11 -0400
From: "Andrew F. Lee" <andrewf@cp.pathfinder.com>
Subject: Re: Snobby news group
Message-Id: <Pine.GSO.3.95.980420151904.12475A-100000@cp.pathfinder.com>

On Mon, 20 Apr 1998, ELSS Admin wrote:
>If you're not
> interested in helping or paid to help ... shut up!

Thank you for absolute and pristine clarity on this issue.  Wish I hd said
that!  :-)
-------------------------------------------------------------
Andrew F. Lee                 |                              |
Software Engineer             |  parenttime.com              |
email: andrewf@pathfinder.com |  1271 Avenue of the Americas |
Phone: (212) 522-2769         |  New York, N.Y. 10020        |
-------------------------------------------------------------
        When I say, "Ignore the man behind the curtain."   
        That is because there is no man behind the curtain.



------------------------------

Date: Mon, 20 Apr 1998 18:08:43 -0500
From: "Keith G. Murphy" <keithmur@mindspring.com>
Subject: Re: Snobby news group
Message-Id: <353BD57B.FA17F1D6@mindspring.com>

Database Coder wrote:
> 
> Why is this such a snobby unhelpful news group. I have posted in many other
> news groups and always recieved polite and helpful responses. This news
> group is the exception. The amount of time you people spend asking people if
> they read the FAQ or bought a good book on PERL could have been spent
> helping the person.

There *IS* a different attitude on the part of the "old hands" on this
group than on other groups I've seen.  I certainly wouldn't complain
about it, since advising you to read the FAQ or a book is usually the
most helpful advice you could get.

It's interesting to me to see how the "attitood" (Philly accent) might
affect the postings.  I haven't noticed that it's cut down on a lot of
clueless questions, vs. what I see on the other groups.  On the other
hand, seems like more of the old hands, that is, people who *REALLY,
REALLY, REALLY* know the answers stick around more and answer more
questions.  (More like on, say, Microsoft's groups, but those MVPs are
rewarded by MS somewhat).

Maybe the "snobbery" is cathartic for them?  If so, be snobby as hell,
but stick around and help us!  :-)


------------------------------

Date: Mon, 20 Apr 1998 20:41:30 -0400
From: Anna Shparberg <ashparbe@indiana.edu>
Subject: Re: Snobby news group
Message-Id: <353BEB3A.8B307BA7@indiana.edu>

A couple of weeks ago I posted a very newbie question on this newsgroup.
Immediately I received not less than three very helpful replies with different
strategies to deal with my problem.  I was amazed at the prompt response and the
willingness of those experienced people to share their knowledge.  As a matter of
fact, I have been wanting to post a thank you note here for some time.  If every
newsgroup were as snobby as this one...

Anna

Keith G. Murphy wrote:

> Database Coder wrote:
> >
> > Why is this such a snobby unhelpful news group. I have posted in many other
> > news groups and always recieved polite and helpful responses. This news
> > group is the exception. The amount of time you people spend asking people if
> > they read the FAQ or bought a good book on PERL could have been spent
> > helping the person.
>
> There *IS* a different attitude on the part of the "old hands" on this
> group than on other groups I've seen.  I certainly wouldn't complain
> about it, since advising you to read the FAQ or a book is usually the
> most helpful advice you could get.
>
> It's interesting to me to see how the "attitood" (Philly accent) might
> affect the postings.  I haven't noticed that it's cut down on a lot of
> clueless questions, vs. what I see on the other groups.  On the other
> hand, seems like more of the old hands, that is, people who *REALLY,
> REALLY, REALLY* know the answers stick around more and answer more
> questions.  (More like on, say, Microsoft's groups, but those MVPs are
> rewarded by MS somewhat).
>
> Maybe the "snobbery" is cathartic for them?  If so, be snobby as hell,
> but stick around and help us!  :-)





------------------------------

Date: Tue, 21 Apr 1998 05:20:13 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Snobby news group
Message-Id: <ebohlmanErr05q.3sn@netcom.com>

Fain <mindmore@mindless.com> wrote:
: In my opinion (and only mine I'm sure), I think we shouldn't regulate the
: group at all (if that is what we are talking about). Even if we all have to
: download 2,000 messages a day. The reason is because USENET programs are
: getting much better in that now I can search for something in a particular
: message or just the Directory. So, if I'm looking for something in particular
: then it's not so hard to find. However... If i'm the type of person that
: starts at the top of the list of new messages and just start going down, then
: I need to know when to stop.

Downloading 2000 messages a day could be a serious hardship for a lot of 
people.  Keep in mind that for most people outside the US and Canada, the 
unbilled local telephone call is a fantasy, not a reality.  People 
actually have to pay for download time.  Also keep in mind that every 
news server that carries a group has to store the posts in the group 
locally, and that disk drives that can handle the kind of thrashing a 
news server gives cost a lot more than your run-of-the-mill IDE drives 
for desktop machines.  And also keep in mind that to the majority of ISP 
customers, "the Internet" means HTTP and SMTP, not NNTP, so spending more 
money to store more news posts is a rather low priority at most ISPs.  
More posts in a group usually translates to shorter expiration times, not 
more storage.



------------------------------

Date: 20 Apr 1998 00:35:15 GMT
From: mmueller@ws8.fas.harvard.edu (Mark Mueller)
Subject: Socket Options for Multicast
Message-Id: <6he583$qh8$1@news.fas.harvard.edu>
Keywords: setsockopt IP_ADD_MEMBERSHIP

Folks,

I'm attempting to join a multicast group, but when I try to use setsockopt,
it fails due to an invalid argument.  I've looked all over for info on
IP_ADD_MEMBERSHIP, but don't find it referenced anywhere.

I've got to admit that the socket options I'm using aren't defined, so I'm
using the ints I found in /usr/include/netinet/in.h.  (0 for IPPROTO_IP and 12 for 
IP_ADD_MEMBERSHIP.)  I figured that perl just passes the arguments along to C,
so I thought I could get away with it.

Any ideas how I could make this work?  Here's my code:

#!/usr/bin/perl -w
require 5.002;
use strict;
use Socket;

my ($group, $port, $proto, $data);

$group = gethostbyname('sap.mcast.net');
print inet_ntoa($group), "\n";
$port = 9875;
$proto = getprotobyname('udp');
socket(SOCK, PF_INET, SOCK_DGRAM, $proto) or die "socket: $!";

setsockopt(SOCK, SOL_SOCKET, SO_REUSEADDR, 1) or die "setsockopt: $!";
bind(SOCK, sockaddr_in($port, $group)) or die "bind: $!";

setsockopt(SOCK, 0, 12, $group) or die "setsockopt: $!";

$data = recv(SOCK, $data, 80, 0);

  Mark 


------------------------------

Date: Sun, 19 Apr 1998 12:01:00 -0400
From: <rdschramm@earthlink.net>
Subject: Re: Sorting an associative array.
Message-Id: <6hd77h$3uf@argentina.earthlink.net>

If you know your values are all unique, you can use the reverse function
against the hash.  That will make the values into keys, and keys into
values.  You can then sort on the key.

Otherwise, you may have to write all the values to a non-associative array
and then sort them there.

Han Yiguang (Hang) wrote in message
<3539d938.6649433@news.singnet.com.sg>...
>Hi,
>
>I am stuck with the problem of sorting an associative array.
>Can a Perl guru help?
>
>My associative array contains something like...
>
>Key, Value
>C, 192
>D, 67
>A, 129
>Z, 16
>J, 28
>B, 183
>L, 67
>
>
>foreach $i (sort keys %aalist)
>{
>  print "$aalist{$i}\n";
>}
>
>But this gives me a sort on the keys.  Even if I use this...
>
>foreach $i (sort %aalist)
>{
>  print "$aalist{$i}\n";
>}
>
>It didn't help.  Anyway to sort on the values?  And in numerical
>manner?
>
>Thanks!
>
>
>Thank you.
>
>Jason




------------------------------

Date: Sun, 19 Apr 1998 11:18:05 -0700
From: "Larry Rosler" <lr@hpl.hp.com>
Subject: Re: Sorting an associative array.
Message-Id: <6hdf4u$kqf@hplntx.hpl.hp.com>

rdschramm@earthlink.net wrote in message
<6hd77h$3uf@argentina.earthlink.net>...
>If you know your values are all unique, you can use the reverse
function
>against the hash.  That will make the values into keys, and keys into
>values.  You can then sort on the key.

They are not unique, as you can see by looking at the example data
submitted.  However, this gives me an opportunity to improve on the
previous submission and offer a stable secondary alphabetical sort:

@jpg_new = map  { $_->[0] }
             sort { $b->[1] <=> $a->[1] or $a->[0] cmp $b->[0] }
             map  { [ $_, /, (\d+)/ ] }
             @jpgs;

>Otherwise, you may have to write all the values to a non-associative
array
>and then sort them there.

Why bother?

>Han Yiguang (Hang) wrote in message
><3539d938.6649433@news.singnet.com.sg>...
>>Hi,
>>
>>I am stuck with the problem of sorting an associative array.
>>Can a Perl guru help?
>>
>>My associative array contains something like...
>>
>>Key, Value
>>C, 192
>>D, 67
>>A, 129
>>Z, 16
>>J, 28
>>B, 183
>>L, 67

--
Larry Rosler
Hewlett-Packard Laboratories
lr@hpl.hp.com





------------------------------

Date: 20 Apr 1998 05:52:28 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Sorting an associative array.
Message-Id: <6henqs$kps$1@comdyn.comdyn.com.au>

In article <3539d938.6649433@news.singnet.com.sg>,
	hangyk@singnet.com.sg (Han Yiguang (Hang)) writes:
> Hi,
> 
> I am stuck with the problem of sorting an associative array.
> Can a Perl guru help?

The perl gurus already have provided help for you. Your perl
installation should come with a full set of documentation, part of
which are the FAQs. It should also come with a tool called 'perldoc'
to read this documentation

# perldoc perl
# perldoc perldoc

Now, for your sorting questions

# perldoc perlfaq
# perldoc perlfaq4
  / How do I sort a hash (optionally by value instead of key)?
  / How do I sort an array by (anything)?

And for the 'numerical' sort:

# perldoc -f sort
  / Look for one of the examples

If either the documentation or perldoc are missing, you need to get a
better perl installation. 

HTH
Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | You can't have everything, where would
Commercial Dynamics Pty. Ltd.       | you put it?
NSW, Australia                      | 


------------------------------

Date: 20 Apr 1998 03:18:37 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Sorting Arrays to Numbers
Message-Id: <6heeqe$sj2$1@marina.cinenet.net>

Larry Rosler (lr@hpl.hp.com) wrote:
: 2.  Your map works, but by coincidence.  As this is a list context,
: there are actually three elements in each anonymous array, and you are
: sorting on the second element, which *is* the extracted digit string. 
: So:
:               map  { [ $_, /=(\d+)/ ] }

Wow.  See, there's always more Perl enlightenment waiting around the 
bend.  Thanks!

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


------------------------------

Date: Mon, 20 Apr 1998 21:07:33 -0400
From: Sahagian <sahagian@ziplink.net>
Subject: spoiled noobie
Message-Id: <353BF155.4384@ziplink.net>

I grew up? with the trim() function which returns a string with the
leading and the trailing space-chars removed.

Any elegant way to do this in PERL5 ?  Thanks. -dvs-


------------------------------

Date: Tue, 21 Apr 1998 00:27:39 -0400
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
Subject: Re: spoiled noobie
Message-Id: <353C203E.3244D1F4@coos.dartmouth.edu>

Sahagian wrote:
> 
> I grew up? with the trim() function which returns a string with the
> leading and the trailing space-chars removed.
> 
> Any elegant way to do this in PERL5 ?

Did you grow up with FAQs too?

http://www.perl.com/CPAN-local/doc/FAQs/FAQ/PerlFAQ.html#How_do_I_strip_blank_space_from_

-- 
 _ / '  _      /         - aka -             rjk@coos.dartmouth.edu
( /)//)//)(//)/(    Ronald J. Kimball           chipmunk@m-net.arbornet.org
    /                                   http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


------------------------------

Date: Tue, 21 Apr 1998 19:14:15 -0400
From: kpreid@ibm.net (Kevin Reid)
Subject: Re: spoiled noobie
Message-Id: <1d7u6f8.14nhmg61dh9jmwN@slip-32-100-246-212.ny.us.ibm.net>

Lloyd Zusman <ljz@asfast.com> wrote:

> kpreid@ibm.net (Kevin Reid) writes:
> > $var =~ s/^\s*([^ ]*)\s*$/$1/;
> > 
> > That's about as elegant as it gets.
> 
> I'm sorry to interject here, but the above regexp will not work to
> remove leading and trailing white space from the following string, or
> any string which contains embedded white space:
> 
>    $var = "   abc  def   ";

exclaim($ARGH);

$me{intelligence} = 0;

$mistakes++;

-- 
  Kevin Reid.      |         Macintosh.
   "I'm me."       |      Think different.


------------------------------

Date: 20 Apr 1998 18:48:58 GMT
From: Greg Bacon <gbacon@cs.uah.edu>
Subject: Statistics for comp.lang.perl.misc
Message-Id: <6hg5aq$6cp$1@info.uah.edu>

Following is a summary of articles spanning a 7 day period,
beginning at 13 Apr 1998 15:04:38 GMT and ending at
20 Apr 1998 06:10:19 GMT.

Notes
=====

    - A line in the body of a post is considered to be original if it
      does *not* match the regular expression /^\s{0,3}(?:>|:|\S+>|\+\+)/.
    - All text after the last cut line (/^-- $/) in the body is
      considered to be the author's signature.
    - The scanner prefers the Reply-To: header over the From: header
      in determining the "real" e-mail address and name.
    - Original Content Rating (OCR) is the ratio of the original content
      volume to the total body volume.
    - Please send all comments to Greg Bacon <gbacon@cs.uah.edu>.

Excluded Posters
================

perlfaq-suggestions\@mox\.perl\.com

Totals
======

Posters:  562
Articles: 1619 (620 with cutlined signatures)
Threads:  449
Volume generated: 2804.3 kb
    - headers:    1133.1 kb (22,760 lines)
    - bodies:     1573.7 kb (48,082 lines)
    - original:   1102.9 kb (35,800 lines)
    - signatures: 96.0 kb (1,987 lines)

Original Content Rating: 0.701

Averages
========

Posts per poster: 2.9
    median: 1.0 post
    mode:   1 post - 358 posters
    s:      6.8 posts
Posts per thread: 3.6
    median: 2 posts
    mode:   1 post - 129 threads
    s:      4.5 posts
Message size: 1773.7 bytes
    - header:     716.7 bytes (14.1 lines)
    - body:       995.3 bytes (29.7 lines)
    - original:   697.6 bytes (22.1 lines)
    - signature:  60.7 bytes (1.2 lines)

Top 10 Posters by Number of Posts
=================================

         (kb)   (kb)  (kb)  (kb)
Posts  Volume (  hdr/ body/ orig)  Address
-----  --------------------------  -------

   91   145.6 ( 75.6/ 57.8/ 36.0)  Tom Phoenix <rootbeer@teleport.com>
   58    96.4 ( 45.2/ 42.1/ 18.9)  abigail@fnx.com
   49    74.2 ( 31.6/ 42.5/ 31.9)  "Grinch" <grinch@whoville.com>
   42    74.6 ( 26.8/ 47.8/ 35.2)  Gellyfish@btinternet.com
   37    65.0 ( 23.8/ 41.2/ 29.0)  cberry@cinenet.net (Craig Berry)
   30    43.7 ( 22.9/ 17.6/  6.7)  Bob Trieger <sowmaster@juicepigs.com>
   28    45.7 ( 14.3/ 31.0/ 24.1)  aml@world.std.com (Andrew M. Langmead)
   27    57.7 ( 21.1/ 35.6/ 25.6)  Zenin <zenin@archive.rhps.org>
   26    39.8 ( 15.8/ 22.5/ 16.6)  Jonathan Feinberg <jdf@pobox.com>
   26    42.9 ( 17.9/ 19.5/ 13.5)  mgjv@comdyn.com.au (Martien Verbruggen)

These posters accounted for 25.6% of all articles.

Top 10 Posters by Volume
========================

  (kb)   (kb)  (kb)  (kb)
Volume (  hdr/ body/ orig)  Posts  Address
--------------------------  -----  -------

 145.6 ( 75.6/ 57.8/ 36.0)     91  Tom Phoenix <rootbeer@teleport.com>
  96.4 ( 45.2/ 42.1/ 18.9)     58  abigail@fnx.com
  74.6 ( 26.8/ 47.8/ 35.2)     42  Gellyfish@btinternet.com
  74.2 ( 31.6/ 42.5/ 31.9)     49  "Grinch" <grinch@whoville.com>
  65.0 ( 23.8/ 41.2/ 29.0)     37  cberry@cinenet.net (Craig Berry)
  57.7 ( 21.1/ 35.6/ 25.6)     27  Zenin <zenin@archive.rhps.org>
  49.9 ( 11.0/ 38.3/ 25.6)     17  Lloyd Zusman <ljz@asfast.com>
  47.3 ( 14.3/ 33.0/ 16.3)     19  Larry Rosler <lr@hpl.hp.com>
  45.7 ( 14.3/ 31.0/ 24.1)     28  aml@world.std.com (Andrew M. Langmead)
  44.6 ( 19.9/ 24.7/ 19.0)     23  sneaker@mediaone.net

These posters accounted for 25.0% of the total volume.

Top 10 Posters by OCR (minimum of five posts)
==============================================

         (kb)    (kb)
OCR      orig /  body  Posts  Address
-----  --------------  -----  -------

1.000  (  3.3 /  3.3)      5  gabor@vmunix.com (Gabor)
1.000  (  2.8 /  2.8)      7  ceison@lis.net.au
0.995  (  5.5 /  5.5)      6  fl_aggie@thepentagon.com (I R A Aggie)
0.976  ( 10.5 / 10.7)     13  pudge@pobox.com (Chris Nandor)
0.897  (  3.5 /  3.9)      5  bidyut@yahoo.com
0.847  ( 12.0 / 14.1)     10  tchrist@mox.perl.com (Tom Christiansen)
0.822  (  7.1 /  8.6)     11  bart.mediamind@tornado.be (Bart Lateur)
0.819  ( 11.8 / 14.4)     16  smcdow@arlut.utexas.edu (Stuart McDow)
0.813  ( 14.4 / 17.7)      6  Greg Bacon <gbacon@cs.uah.edu>
0.778  ( 24.1 / 31.0)     28  aml@world.std.com (Andrew M. Langmead)

Bottom 10 Posters by OCR (minimum of five posts)
=================================================

         (kb)    (kb)
OCR      orig /  body  Posts  Address
-----  --------------  -----  -------

0.495  (  3.3 /  6.7)      7  tmornini@netcom.com (Tom Mornini)
0.493  ( 16.3 / 33.0)     19  Larry Rosler <lr@hpl.hp.com>
0.488  (  1.9 /  3.8)      6  kpreid@ibm.net (Kevin Reid)
0.480  (  1.7 /  3.6)      5  mjtg@cus.cam.ac.uk (M.J.T. Guy)
0.473  (  3.4 /  7.2)     10  Ben Bullock <ben@hayamasa.demon.co.uk>
0.464  (  2.5 /  5.3)      5  "Scott" <sdh1@anchor.hotmail.com>
0.451  (  5.2 / 11.6)      5  mikeh@minivend.com (Mike Heins)
0.450  ( 18.9 / 42.1)     58  abigail@fnx.com
0.448  (  3.9 /  8.7)     12  "Bob Gwynne" <gwynne@utkux.utk.edu>
0.380  (  6.7 / 17.6)     30  Bob Trieger <sowmaster@juicepigs.com>

Top 10 Threads by Number of Posts
=================================

Posts  Subject
-----  -------

   44  Bill Gates should be invited to O'Reilly's "Free Software Summit" (was Re: RMS should be invited to O'Reilly's "Free Software Summit")
   31  Snobby news group
   23  Hide or Encrypt perl source code
   23  how to remove blanks?
   19  Easy way to count lines in a file
   19  commenting a whole block?
   19  Perl 5.004_64 Slower???
   19  info on cookies
   18  Array / List question
   17  looking for a good win32 perl editor.

These threads accounted for 14.3% of all articles.

Top 10 Threads by Volume
========================

  (kb)   (kb)  (kb)  (kb)
Volume (  hdr/ body/ orig)  Posts  Subject
--------------------------  -----  -------

 107.6 ( 52.7/ 49.2/ 29.6)     44  Bill Gates should be invited to O'Reilly's "Free Software Summit" (was Re: RMS should be invited to O'Reilly's "Free Software Summit")
  64.2 ( 20.5/ 40.8/ 30.3)     31  Snobby news group
  62.2 ( 18.4/ 42.1/ 26.5)     23  how to remove blanks?
  51.1 ( 16.9/ 32.3/ 20.0)     19  info on cookies
  42.5 (  2.2/ 40.3/ 32.0)      3  *****$$HONEST WAY to make REAL MONEY$$*****
  36.4 ( 16.2/ 18.3/ 12.4)     23  Hide or Encrypt perl source code
  35.6 ( 12.4/ 22.5/ 15.8)     16  Fastest "smallest power of 2 >= N" in Perl?
  35.4 ( 14.5/ 19.9/ 11.4)     19  commenting a whole block?
  34.1 (  8.9/ 24.6/ 19.8)     12  OOPS and several parents
  32.8 ( 14.3/ 17.2/ 13.0)     19  Perl 5.004_64 Slower???

These threads accounted for 17.9% of the total volume.

Top 10 Threads by OCR (minimum of five posts)
==============================================

         (kb)    (kb)
OCR      orig /  body  Posts  Subject
-----  --------------  -----  -------

0.927  (  3.0/   3.2)      5  How do I get the name of each file in a dir?
0.894  (  2.9/   3.2)      5  push a non HTML document to a web browser?
0.888  (  2.2/   2.5)      5  server scripts
0.803  ( 19.8/  24.6)     12  OOPS and several parents
0.789  (  1.1/   1.4)      5  Perl Oddity
0.782  (  9.9/  12.7)      5  Intermittent Perl problems
0.778  (  5.9/   7.6)     17  looking for a good win32 perl editor.
0.777  (  5.6/   7.3)     11  File download problem in IE4.0
0.754  ( 13.0/  17.2)     19  Perl 5.004_64 Slower???
0.747  (  3.2/   4.2)      5  putc?

Bottom 10 Threads by OCR (minimum of five posts)
=================================================

         (kb)    (kb)
OCR      orig /  body  Posts  Subject
-----  --------------  -----  -------

0.528  (  1.9 /  3.7)      9  Server Side Include
0.525  (  4.9 /  9.3)      8  rand($.) (was wc-l in Perl)
0.506  (  4.9 /  9.7)      7  Memory Leak?  Embedding into C
0.482  (  1.3 /  2.6)      7  Question?
0.475  (  6.0 / 12.6)     16  [Q] find largest value in key of associative array?
0.470  (  2.8 /  6.0)      7  considerations for global variables?
0.457  (  2.4 /  5.2)      7  Project involving Word
0.439  (  2.0 /  4.6)      7  Perl, HP-UX, and memory ...
0.428  (  5.5 / 13.0)     11  Can someone give me an example of rounding!
0.414  (  2.3 /  5.5)      9  Farnham's Freehold

Top 10 Targets for Crossposts
=============================

Articles  Newsgroup
--------  ---------

      54  comp.os.linux.misc
      54  gnu.misc.discuss
      16  sci.math
      16  sci.math.num-analysis
      13  comp.lang.perl.modules
       9  comp.lang.perl
       5  comp.unix.shell
       4  comp.lang.perl.tk
       4  de.comp.lang.perl
       2  misc.jobs.contract

Top 10 Crossposters
===================

Articles  Address
--------  -------

      20  Ben Bullock <ben@hayamasa.demon.co.uk>
      19  pudge@pobox.com (Chris Nandor)
      14  "Ron Peterson" <peterrj@mail.state.wi.us>
      12  Lloyd Zusman <ljz@asfast.com>
       8  Bill Anderson <ucntcme@cyberhighway.net>
       6  borchert@mathematik.uni-ulm.de
       6  tzs@halcyon.com (Tim Smith)
       5  Fabrizio Pivari <pivari@geocities.com>
       4  Larry Rosler <lr@hpl.hp.com>
       4  alecler@cam.org (Andre L.)


------------------------------

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.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 2388
**************************************

home help back first fref pref prev next nref lref last post