Article View: news.software.readers
Article #46221Re: [slrn] Saving new/unread articles?
From: to... tony summerfelt
Date: Tue, 02 Feb 1999 00:00
Date: Tue, 02 Feb 1999 00:00
37 lines
2188 bytes
2188 bytes
On 1 Feb 1999 22:40:48 GMT, John E. Davis wrote:
> But if sorted numerically, you will get:
ok, i get it now. i was (wrongly) assuming that perl would sort numbers
numerically. usually perl assumptions work, but not in this case. i DID say
i was a perl novice :)
this is the fix for the problem.
put this line near the top or bottom (wherever you put your subroutines)
sub numerically {$a <=> $b;}
and this bit:
opendir(dir, $newsdir);
@articles = sort grep(/\d+/, readdir(dir));
closedir(dir);
will now be:
opendir(dir, $newsdir);
@unsorted_articles = grep(/\d+/, readdir(dir));
@articles = sort numerically @unsorted_articles
closedir(dir);
--
t
*-------------------------------------------------------------------------
| origin: ...the vented spleen kingston on (613-544-9332) 1:249/139
|
| `you want a toe? i can get you a toe'
|
| take myspleen out to reply via email
*-------------------------------------
Technical Details
Message-ID:
<36b7672e.0@news.kosone.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp!not-for-mailReferences:
<CBdq2.114$yk7.461@news.get2net.dk> <36aaa085.0@news.kosone.com> <RONq2.59$sG5.292@news.get2net.dk> <36ae8466.0@news.kosone.com> <slrn7atdac.iie.davis@aluche.mit.edu> <36b23651.0@news.kosone.com> <slrn7b4hkg.sse.davis@aluche.mit.edu> <36b38c8d.0@news.kosone.com> <8790ekruhs.fsf@pc-hrvoje.srce.hr> <36b600fa.0@news.kosone.com> <slrn7bcbbe.6cm.davis@aluche.mit.edu>Show Full Headers
Complete Article Headers
Message-ID: <36b7672e.0@news.kosone.com> Subject: Re: [slrn] Saving new/unread articles? Date: Tue, 02 Feb 1999 00:00:00 +0000 From: to...@myspleen.kos.net (tony summerfelt) References: <CBdq2.114$yk7.461@news.get2net.dk> <36aaa085.0@news.kosone.com> <RONq2.59$sG5.292@news.get2net.dk> <36ae8466.0@news.kosone.com> <slrn7atdac.iie.davis@aluche.mit.edu> <36b23651.0@news.kosone.com> <slrn7b4hkg.sse.davis@aluche.mit.edu> <36b38c8d.0@news.kosone.com> <8790ekruhs.fsf@pc-hrvoje.srce.hr> <36b600fa.0@news.kosone.com> <slrn7bcbbe.6cm.davis@aluche.mit.edu> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp!not-for-mail X-Deja-AN: 439904131 X-Trace: newsfeed.slurp.net 917989215 199.246.3.130 (Tue, 02 Feb 1999 15:00:15 CDT) Organization: Kingston Online Services User-Agent: slrn/0.9.5.4 (UNIX) Reply-To: to...@myspleenkos.net NNTP-Posting-Date: Tue, 02 Feb 1999 15:00:15 CDT Newsgroups: news.software.readers,alt.lang.s-lang