[13143] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 553 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Aug 16 10:08:35 1999

Date: Mon, 16 Aug 1999 07:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 16 Aug 1999     Volume: 9 Number: 553

Today's topics:
    Re: A module to create bibliographic entries <randy@theoryx5.uwinnipeg.ca>
    Re: automatic text formatting for 80 chars a line <jpeterson@office.colt.net>
    Re: automatic text formatting for 80 chars a line (Anno Siegel)
        determining a leap year (Linda Minnich)
    Re: determining a leap year (Linda Minnich)
    Re: HARASSMENT -- Monthly Autoemail (I R A Darth Aggie)
    Re: HARASSMENT -- Monthly Autoemail (I R A Darth Aggie)
    Re: HARASSMENT -- Monthly Autoemail (I R A Darth Aggie)
    Re: HARASSMENT -- Monthly Autoemail (I R A Darth Aggie)
    Re: HARASSMENT -- Monthly Autoemail (Anno Siegel)
    Re: HTTP redirect..not working (Miguel Cruz)
        launching applications (Helen Sian Ashton)
        Message-ID vs. Reference Header ("Bill Jones")
        mod (%) in PERL (Linda Minnich)
    Re: mod (%) in PERL <jpeterson@office.colt.net>
    Re: mod (%) in PERL (Anno Siegel)
        ODBC & UNIX pyammine@my-deja.com
    Re: Parsing flat file v's MSQL with a Perl CGI script <jpeterson@office.colt.net>
    Re: parsing tecnique <jpeterson@office.colt.net>
    Re: parsing tecnique <mcmike123@worldnet.att.net>
    Re: Perl data type size (max and min values) (Abigail)
    Re: Retrieving TEXTAREA information using CGI (post met <bholness@nortelnetworks.com>
        Sorting hash in ascending/descending order? arpith@hotmail.com
    Re: Sorting hash in ascending/descending order? <jpeterson@office.colt.net>
    Re: Why It's Cool To Make Fun Of Bad Code (Chris)
    Re: Why It's Cool To Make Fun Of Bad Code (Chris)
    Re: Why use Perl when we've got Python?! <I.Clarke@strs.co.uk>
    Re: Why use Python when we've got Perl? <I.Clarke@strs.co.uk>
        Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)

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

Date: 16 Aug 1999 13:13:16 GMT
From: Randy Kobes <randy@theoryx5.uwinnipeg.ca>
Subject: Re: A module to create bibliographic entries
Message-Id: <7p92pc$oal$1@canopus.cc.umanitoba.ca>

In comp.lang.perl.misc, Jim <jcarlson@stanford.edu> wrote:

> Has anyone here seen a perl module (or anything else, for that matter)
> which takes
> a variety of information about a particular work (e.g., title, author,
> editor) and, 
> depending on the type of work (article,book,review) assembles it into a
> valid 
> bibliographical entry, following some major convention?

Hi,
   Perhaps the Text-BibTeX module, under $CPAN/authors/id/GWARD/,
may be of some help, either directly or as a guide in writing
your own.

		best regards,
		Randy Kobes
-- 
Physics Department		Phone: 	   (204) 786-9399
University of Winnipeg		Fax: 	   (204) 774-4134
Winnipeg, Manitoba R3B 2E9	e-mail:	   randy@theoryx5.uwinnipeg.ca
Canada				http://theory.uwinnipeg.ca/


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

Date: Mon, 16 Aug 1999 12:47:17 GMT
From: Jon Peterson <jpeterson@office.colt.net>
Subject: Re: automatic text formatting for 80 chars a line
Message-Id: <pLTt3.109$u07.1003@news.colt.net>

Michael Scheferhoff <m.scheferhoff@gmx.de> wrote:
> Hello,

> does anybody know how to format a text so that I have 80 characters in a
> line. Is there a command for this?

Check out CPAN - www.perl.com/CPAN

Look out for the modules Text::Wrapper and/or Text::Format, which should let
you do what you want.




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

Date: 16 Aug 1999 13:21:33 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: automatic text formatting for 80 chars a line
Message-Id: <7p938t$29t$1@lublin.zrz.tu-berlin.de>

Michael Scheferhoff  <m.scheferhoff@gmx.de> wrote in comp.lang.perl.misc:
>Hello,
>
>does anybody know how to format a text so that I have 80 characters in a
>line. Is there a command for this?

Suppost your long line is in $long (no linefeed), such as

my $long = '0123456789' x 23;

then collect the <= 80 character parts in @parts:

my @parts;
for ( my $i = 0; $i < length $long; $i += 80 ) {
  push @parts, substr( $long, $i, 80);
}

Anno


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

Date: Mon, 16 Aug 1999 13:13:50 GMT
From: lin.minnich@usa.net (Linda Minnich)
Subject: determining a leap year
Message-Id: <37b80e37.3412597@nntp.lucent.com>

Does anyone know much about an algorithm to determine whether or not
the current year is a leap year or not?  I'm trying find one!  I don't
remember how many years are inbetween leap years, or even when the
last or next one is!!! If you could just help me out with that tiny
amt of info I would be greatful and I could write my own algorithm.
Thanks :)
Linda


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

Date: Mon, 16 Aug 1999 13:22:17 GMT
From: lin.minnich@usa.net (Linda Minnich)
Subject: Re: determining a leap year
Message-Id: <37b81018.3893721@nntp.lucent.com>

AhA! I'm going to answer my own question here so if anyone else needs
this info this is it:

Firstly, here is the rule. A year is a leap year (and so contains a
February 29) if it is divisible by 4. But if the year is
also divisible by 100 then it is not a leap year, unless it is
divisible by 400. This means that years such as 1992, 1996
are leap years because they are divisible by 4 and are not affected by
the rest of the rule which applies to century
years such as 1900 and 2000. Century years are not leap years except
where they are a multiple of 400. Hence, the
years 1700, 1800 and 1900 were not leap years and did not contain a
February 29. But the year 2000 will be a leap
year, the first such century leap year since 1600. 


So there ya go if ya need it!:) I'm attempting my algorithm right
now!!!!
-Linda



On Mon, 16 Aug 1999 13:13:50 GMT, lin.minnich@usa.net (Linda Minnich)
wrote:

>Does anyone know much about an algorithm to determine whether or not
>the current year is a leap year or not?  I'm trying find one!  I don't
>remember how many years are inbetween leap years, or even when the
>last or next one is!!! If you could just help me out with that tiny
>amt of info I would be greatful and I could write my own algorithm.
>Thanks :)
>Linda



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

Date: 16 Aug 1999 13:35:24 GMT
From: fl_aggie@thepentagon.com (I R A Darth Aggie)
Subject: Re: HARASSMENT -- Monthly Autoemail
Message-Id: <slrn7rg50r.nhi.fl_aggie@thepentagon.com>

On Sun, 15 Aug 1999 11:30:14 -0700, REBUS <rebus@access.com>, in
<rre1ka1ekrl80@corp.supernews.com> wrote:

[me]
+ >+ >You realize that by posting to Usenet, you are implicitly permitting
+ >+ >email responses?

+ >On Sun, 15 Aug 1999 03:35:54 GMT, Gil Harvey <gh@netquick.net>, in
+ ><37b6355f.18129321@news.interpath.net> wrote:

+ >+ No - I'm permetting responses to my post in the same forum I
+ >+ posted. Get real....

[me again]
+ >If that's what you believe, then stop posting to usenet.

+ I fail to see your logic here. If one posts to USENET, it does not imply,
+ that one is responsive to email responses.

I didn't say *responsive*. Go back and re-read what I said. There is an
implication in what I said, tho.

+ However, it also comes as no surprise, that if you post your email address,
+ you are allowing other to send you 'unsolicited' emails.

No. You lose. Thank's for playing, tho. I'll draw you picture, it
will take you less time...

You post a question to misc.for-sale.widgets, 'cause you want to know
what the going rate for a Model 31 widget is. You get several in-group
postings, but you also get several in email. Some tell you what you want
to know, some others inquire if you're in the market to buy, and some
else asks if you're selling.

Common link: your original posting about a Model 31 widget.

Someone else sees your posting, and sends email that they've plenty of
Model 41's, 51's and 61's at LOW LOW PRICES. *That* is unsolicited,
because you *never* asked about those models.

Does that make sense?

+ As far as TC using
+ an autoresponder to enforce usenet etiquette, it could be in violation of
+ most US State 

Mostly deal with *commercial* spam...

+ and Federal "SPAM" laws

Name one. As in "one spam law of a federal nature".

James - hint: there *isn't* one on the books, despite what some spammers
        may want to believe...

-- 
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/doc/FAQs/cgi/idiots-guide.html>


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

Date: 16 Aug 1999 13:37:34 GMT
From: fl_aggie@thepentagon.com (I R A Darth Aggie)
Subject: Re: HARASSMENT -- Monthly Autoemail
Message-Id: <slrn7rg54u.nhi.fl_aggie@thepentagon.com>

On Sun, 15 Aug 1999 19:21:24 GMT, Gil Harvey <gh@netquick.net>, in
<37b7130f.894473@news.interpath.net> wrote:
+ On 15 Aug 1999 15:51:59 GMT, fl_aggie@thepentagon.com (I R A Darth
+ Aggie) wrote:
+ 
+ 
+ >
+ >If that's what you believe, then stop posting to usenet.
+ 
+ 	Unsolicted mail is unsolicted mail - No?

Yep. By posting to Usenet, by implication, you are *soliciting* comments
upon your postings. Some of which may be posted to Usenet, and some of
which may show up in your in-box...

I'm sure you wheren't told that, but it is Usenet practice...

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/doc/FAQs/cgi/idiots-guide.html>


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

Date: 16 Aug 1999 13:44:07 GMT
From: fl_aggie@thepentagon.com (I R A Darth Aggie)
Subject: Re: HARASSMENT -- Monthly Autoemail
Message-Id: <slrn7rg5h7.nhi.fl_aggie@thepentagon.com>

On Mon, 16 Aug 1999 06:13:35 GMT, Michael Rubenstein <miker3@ix.netcom.com>, in
<37b7a952.701300396@nntp.ix.netcom.com> wrote:

+ I R A Darth Aggie has taught them that it is OK to send spam to
+ anyone who posts on usenet.  After all, posting on usenet is an
+ invitation for unsolicited email.

I'll accept your apology for that smear any time once you figure out
that the culture of Usenet says that email-followups to a posting is
acceptable.

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/doc/FAQs/cgi/idiots-guide.html>


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

Date: 16 Aug 1999 13:45:27 GMT
From: fl_aggie@thepentagon.com (I R A Darth Aggie)
Subject: Re: HARASSMENT -- Monthly Autoemail
Message-Id: <slrn7rg5jn.nhi.fl_aggie@thepentagon.com>

On Mon, 16 Aug 1999 11:15:17 +0100, Ian Clarke <I.Clarke@strs.co.uk>, in
<37B7E4B5.6D727879@strs.co.uk> wrote:

+ Tom should grow up, and those defending him should show some backbone.

Backbone? I should have done this days ago. GoAT.

*plonk*

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/doc/FAQs/cgi/idiots-guide.html>


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

Date: 16 Aug 1999 14:03:30 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: HARASSMENT -- Monthly Autoemail
Message-Id: <7p95ni$2k5$1@lublin.zrz.tu-berlin.de>

I R A Darth Aggie <fl_aggie@thepentagon.com> wrote in comp.lang.perl.misc:

>I didn't say *responsive*. Go back and re-read what I said....

Godwin's Lemma:  When the sentence "Go back and re-read what I said"
appears in a Usenet discussion the convergence towards Nazis or Hitler
is quadratic.

Anno


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

Date: Mon, 16 Aug 1999 13:33:41 GMT
From: usenet@admin.u.nu (Miguel Cruz)
Subject: Re: HTTP redirect..not working
Message-Id: <VqUt3.4577$Pw1.37627@news4.giganews.com>

Sunfox <sunfox@sunwerx.com> wrote:
>> Oh look, you hung the entire previous content on the end of your f'up.
>
> Wasn't exactly a great amount of text, y'know. It appears a few of the
> folks in here should be on some sort of mood tranquilizer. Lighten up,
> dude.

It takes you 2 seconds to do it right. Otherwise, a thousand other people
have to page through your quote to see if there's anything else you're
responding to.

miguel


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

Date: Mon, 16 Aug 1999 13:35:47 GMT
From: ceehsa1 (Helen Sian Ashton)
Subject: launching applications
Message-Id: <FGK8Fp.7G0@cee.hw.ac.uk>


I'm trying to use a perl script from a web browser to launch an application. I 
can get the perl script to do everything I want to do if I run it from the DOS 
window - I am using the system command to launch the application. However this 
deosn't work when I run it from the browser, in fact everything but the system 
command seems to work!

I am using a Windows NT PC and have tried this in both Netscape and IE 
browsers. The perl scripts are stored on a UNIX server.

Can anyonw shed some light?

Cheers,

Helen


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

Date: Mon, 16 Aug 1999 08:16:25 -0400
From: bill@fccj.org ("Bill Jones")
Subject: Message-ID vs. Reference Header
Message-Id: <199908161211.IAA23961@astro.fccj.cc.fl.us>

WARNING [Off Topic] You may wish to ignore...

That said, I was told by many that my method of reading and posting to
comp.lang.perl.misc doesn't have a REFERENCES line in my posts.  That line
helps people track threads better (the posts actually show up as a new post
without it.)

So, my off-topic question is:

If I use the Message-ID string in place for the Reference header string -
would that resolve the posting issue?  I have been working on a method of
injecting the References header into the e-mail so that when the
e-mail-to-usenet gateway posts my e-mail it appears to have a proper
References header.

Please follow-up to me directly, no need to flame me in this group :)  If
you do choose to "post here", "read here" me a reply then you are inviting
me to follow-up via mail as I will not continue this thread in the group.

Comments?
-Sneex-  :]
FCCJ Data Security Group
____________________________________________________________________
Bill Jones    Data Security Specialist    http://jacksonville.pm.org

"f u cn rd ths, u cn gt a gd jb n cmptr prgrmmng.", TC in c.l.p.misc



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

Date: Mon, 16 Aug 1999 13:24:16 GMT
From: lin.minnich@usa.net (Linda Minnich)
Subject: mod (%) in PERL
Message-Id: <37b810dd.4090938@nntp.lucent.com>

IS it possible to do a mod function like in C++  represented by the
percentage sign : %  in PERL? 



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

Date: Mon, 16 Aug 1999 13:41:57 GMT
From: Jon Peterson <jpeterson@office.colt.net>
Subject: Re: mod (%) in PERL
Message-Id: <FyUt3.110$u07.1035@news.colt.net>

Linda Minnich <lin.minnich@usa.net> wrote:
> IS it possible to do a mod function like in C++  represented by the
> percentage sign : %  in PERL? 

Yes. To be fair, you could have tried this for yourself before asking, maybe?

Note though that the modulus operator % in perl converts its operands to 
integers. If you want to do floating point stuff you'll need to use the 
POSIX module and check out the fmod() function.

FYI, perl is sometimes 'perl' sometimes 'Perl', but never 'PERL' :_)

Oh, and it's NEVER spelt 'CGI' ;->




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

Date: 16 Aug 1999 13:56:28 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: mod (%) in PERL
Message-Id: <7p95ac$2hu$1@lublin.zrz.tu-berlin.de>

Linda Minnich <lin.minnich@usa.net> wrote in comp.lang.perl.misc:
>IS it possible to do a mod function like in C++  represented by the
>percentage sign : %  in PERL? 

Hmmm... your leap-year algorithm seems to be well on its way.

Short answer to your question: Yes.

Medium answer:  With few exceptions the C operators exist in Perl
(not PERL) as well.

Long answer:  When you have perl, you also have all the documentation
you'll ever need.  It is accessed through the perldoc command that
also comes with perl.  In this case you want the description of Perl
operators: "perldoc perlop".  A search for "%" takes you right there.
You find a more comprehensive description of perldoc via (you guessed
it) "perldoc perldoc".

The Perl documentation is voluminous and it can be hard to find what
you are looking for.  Besides experience, the perlindex command is a
big help.  This one doesn't come with perl, but can be downloaded from
CPAN.

Anno


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

Date: Mon, 16 Aug 1999 13:40:20 GMT
From: pyammine@my-deja.com
Subject: ODBC & UNIX
Message-Id: <7p94c3$340$1@nnrp1.deja.com>

I am fairly new to perl and have a question.

I have been researching into whether or not there is a way to get ODBC
to work in UNIX. we currently have PERL connected through ODBC but on
an IIS and were talking about ditching IIS and wasn't sure how much
changes would have to be made.

I noticed a lot of talk about using DBI instead of the win32::ODBC. So
first, is it possible to use ODBC & UNIX and what is typically more
favored the win32::odbc or DBI?


Thanks in advance for your opinions.

P


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Mon, 16 Aug 1999 12:40:42 GMT
From: Jon Peterson <jpeterson@office.colt.net>
Subject: Re: Parsing flat file v's MSQL with a Perl CGI script
Message-Id: <eFTt3.107$u07.1003@news.colt.net>

Paul Foran <Paul.Foran@analog.com> wrote:
> Can somebody give me the disadvantages of accessing a text file instead
> of a database. My CGI script at  present parses the contents of a
> character seperated database table text file. what are the advantages in
> imorting this text file into msql and getting my script to query a MSQL
> database table instead. My script simply is listing the contents of
> about 30 entries max. It has about 5 cols.

In general, rdbms systems (such as msql) offer at least these advantages:
1. speed, and therefore scaleability.
2. abstraction via a database driver (use different languages to access data)
and likewise use the same program to access different databases.
3. abstraction, and increased power, via SQL for query construction.
4. built in networking (often)
5. built in record locking, rollback etc (often - although not in the case of
msql, I think).

In general text files offer these advantages over rdbms systems
1. Simple (no need to administer the rdbms)
2. Simple to program for simple tasks (but becomes much harder to program for
more complex tasks)
3. The datasource (ie text file) is human readable in its native form, and can
be updated in any text editor.

Of these, number 3 is the only significant one. If your task is much more
than trivial, you should be looking at some kind of rdbms, unless there is
a requirement (and there may well be) to use a datasource that is human
readable/writable.

If you are sure that your text database will never grow much larger, then it
is fine, especially if you are only ever extracting rows based on the value of
one column, or such simple queries.

If you ever need to do updates, or more complex selections, the overhead of
learning DBI and msql will pay off, plus it will do your c.v. no end of good.

Finally, there are perl drivers that will let you access a text file using the
same mechanisms (such as SQL et al.) as you use to access an rdbms, thus
giving you the best of both worlds (in theory..). 

Read up on DBI and DBD modules!




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

Date: Mon, 16 Aug 1999 12:45:10 GMT
From: Jon Peterson <jpeterson@office.colt.net>
Subject: Re: parsing tecnique
Message-Id: <qJTt3.108$u07.1003@news.colt.net>

mike <mcmike123@worldnet.att.net> wrote:
> Whare can i learn about parsing an html document, for the " <a href "
> statments?

1. Learn what a perl module is. Fortunately they are quite simple to use :-)
2. Discover CPAN, by consuming voraciously all that you find at :
www.perl.com/CPAN
3. Look out for the module HTML::LinkExtor, which will do EXACTLY what you 
want .

But, bear in mind that you will need to be familiar with such things as 
references and objects to really use it effectively. However, since this is
the best way of doing things, its worth persevering.



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

Date: Mon, 16 Aug 1999 09:22:45 -0400
From: "mike" <mcmike123@worldnet.att.net>
Subject: Re: parsing tecnique
Message-Id: <7p939a$n7i$1@bgtnsc02.worldnet.att.net>

thank you for the info it will be usefull, I think almost everything i need
will be at CPAN
thanks again :-)


>1. Learn what a perl module is. Fortunately they are quite simple to use
:-)
>2. Discover CPAN, by consuming voraciously all that you find at :
>www.perl.com/CPAN
>3. Look out for the module HTML::LinkExtor, which will do EXACTLY what you
>want .
>
>But, bear in mind that you will need to be familiar with such things as
>references and objects to really use it effectively. However, since this is
>the best way of doing things, its worth persevering.







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

Date: 16 Aug 1999 08:47:34 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Perl data type size (max and min values)
Message-Id: <slrn7rg5lk.99p.abigail@alexandra.delanet.com>

Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote on MMCLXXVI
September MCMXCIII in <URL:news:7p8lhf$1f6$1@lublin.zrz.tu-berlin.de>:
,, Abigail <abigail@delanet.com> wrote in comp.lang.perl.misc:
,, >
,, >     my  $j = my $i = 0;
,, >     do {$j =    $i ++} until $i =~ /Inf/;
,, >     print "The maximum value of a scalar is: $j\n";
,, 
,, PS: Why initialize $j?


Obvious. The program text looks better that way.



Abigail
-- 
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'


  -----------== 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: Mon, 16 Aug 1999 13:26:55 +0100
From: "Ben Holness" <bholness@nortelnetworks.com>
Subject: Re: Retrieving TEXTAREA information using CGI (post method)
Message-Id: <7p903o$18v$1@bcrkh13.ca.nortel.com>

Sorry! I thought that would have been enough information.

I (will) have an html page which has this sort of form:

<html><body><form action="/cgi-bin/test.pl" method=post>
Please enter your name<input name="firstname"><p>
Please enter a description of yourself:<textarea
name="description"></textarea>
<p>
<input type=submit>
</form></body></html>

test.pl will look something like this:

!#/usr/bin/perl
print "Content-type: text/html\n\n";
print "<html><body>";
use CGI;
$query= new CGI;

$fn = $query->param('firstname');

$desc = $query->param('description');

print "Your name is $fn. Your description is $desc";

print "</body></html>";

--

When I tried to run this I got a message that just said "OK". Now, however,
it seems to work OK (albeit on a different machine)!

I will try it again on the other machine later.

Sorry for the lack of information in the first post!

Ben


Graham Ashton <billynospam@mirror.bt.co.uk> wrote in message
news:slrn7rfs5o.v2f.billynospam@wing.mirror.bt.co.uk...
> In article <7p8q8f$pdp$1@bcrkh13.ca.nortel.com>, Ben Holness wrote:
> >
> >How do I get information from a <TEXTAREA> when the form method is POST,
> >using CGI? (the param function doesn't appear to work).
> >
> >Many thanks,
>
> What do you expect us to do? You've not given us enough info, for
> starters. I don't mean to be rude, but if you can't be bothered to post
> a decent description of your problem (i.e. code) then people can't help
> you.
>
> --
> Graham




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

Date: Mon, 16 Aug 1999 13:41:22 GMT
From: arpith@hotmail.com
Subject: Sorting hash in ascending/descending order?
Message-Id: <7p94e0$34i$1@nnrp1.deja.com>

Hi,

I have a HASH, the key being an account number, and the value a rank of
the particular key.

How would I sort the hash in ascending/descending order with respect to
the "rank" values ? So at the end, the HASH should be sorted.

Any help will be greatly appreciated :)

Thanks,

Arpith.



Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Mon, 16 Aug 1999 14:04:48 GMT
From: Jon Peterson <jpeterson@office.colt.net>
Subject: Re: Sorting hash in ascending/descending order?
Message-Id: <4UUt3.111$u07.1035@news.colt.net>

arpith@hotmail.com wrote:
> Hi,

> I have a HASH, the key being an account number, and the value a rank of
> the particular key.

A hash is inherently unordered (at least, not orderd in a way meaningful to
the programmer). What you really want to do is to create a list of the hash
keys in order sorted on their value. This is actually a common task, and it
is covered in the FAQ on sorting:

man perlfaq4 (on unix)

Or better still, have a look at the final word on sorting in Perl:

http://www.perl.com/CPAN/doc/FMTEYEWTK/sort.html



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

Date: Mon, 16 Aug 1999 13:20:20 GMT
From: chrisl@tourneyland.com (Chris)
Subject: Re: Why It's Cool To Make Fun Of Bad Code
Message-Id: <37b80d8c.31800536@news.swbell.net>

>good. now provide a patch to Text::Wrap to make it work better for
>yourself and the rest of us.

Nah, I don't really buy the idea that He Who Points Out a Problem Is
Somehow Obliged To Fix It Too.. Shouldn't you be asking the authors to
patch it? 

Besides, my man James has doen plenty in pointing out Text::Wrap's
problems - and thus saying "Just because it comes with Perl, doesn't
mean it's any good."
>
>uri
>
>-- 
>Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
>uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
>Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
>The Best Search Engine on the Net -------------  http://www.northernlight.com
>"F**king Windows 98", said the general in South Park before shooting Bill.



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

Date: Mon, 16 Aug 1999 13:22:58 GMT
From: chrisl@tourneyland.com (Chris)
Subject: Re: Why It's Cool To Make Fun Of Bad Code
Message-Id: <37b81019.32454025@news.swbell.net>

>Do not use Text::Wrap. Do not recommend to others that they use
>Text::Wrap. Do not post a FAQ list telling people to use Text::Wrap.
>Do not publish books stating that Text::Wrap is what you should
>use to reformat text. Do not include harmful, broken modules with
>the standard Perl distribution. Do not yell at Perl novices because
>they only know the "middle two-thirds" of Perl and so cannot use
>Perl for even the most trivial tasks because the "official" answer
>to EVERY TBQQNZA "How do I..." question they might ask (but should
>NOT ask because the answer is the FAQ) involves parts of the language
>that aren't even touched upon in _Learning Perl_, like modules and
>object-oriented programming and a bunch of other things I don't
>have time to master before I need to wrap a simple line of text!
>And fix Text::Wrap!

Rock On! In particular I couldn't agree more about what you say about
modules and OOP. I looked at perlmod, and it just had me asking "Okay,
where's the REAL docs on modules?" 

>Whew! I feel better now.

Me too. Nice job!
>
>-- 
>Jim Monty
>monty@primenet.com
>Tempe, Arizona USA



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

Date: Mon, 16 Aug 1999 13:14:58 +0100
From: Ian Clarke <I.Clarke@strs.co.uk>
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <37B800C2.4F760A37@strs.co.uk>


> In an article that appeared just before this one on my site's
> news server, you said you employed the language of conflict
> (a subject line similar to a flamewar troll) in order to gain
> attention.

Perhaps, however the nature of a message is not determined by the
subject line alone (if this were the case then Tom would be very guilty
of doing the exact same thing on comp.lang.python when he posted a
comment entitled "Why use Python when we have Perl?").  The contents of
my message made it clear that it was not my intention to troll or start
a flame war, but to learn about the differences between Perl and Python.

Subject versus body - in that debate lies madness...

Ian.


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

Date: Mon, 16 Aug 1999 14:25:09 +0100
From: Ian Clarke <I.Clarke@strs.co.uk>
Subject: Re: Why use Python when we've got Perl?
Message-Id: <37B81135.1B598171@strs.co.uk>

My apologies, this is wandering off-topic, I will keep it short.

Ok, so your point is that I was inciting flames, but that is not in
itself a bad thing.  I can live with that.

> comp.lang.perl.misc is primarily for talking about Perl, not trying to
> defend Perl to a Python advocate.  I'm sure the converse is true of
> comp.lang.python.  Someone who starts a language advocacy flamewar and
> then plays innocent about it isn't exactly holding the moral high ground.

I never claimed to be perfect, Tom's post just angered me as he was
accusing me of fanning the flames where as in he was contributing much
more to the whole thing than I was.

Ian.


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

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

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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu. 

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 553
*************************************


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