[12461] in Perl-Users-Digest
Perl-Users Digest, Issue: 6061 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jun 19 21:07:20 1999
Date: Sat, 19 Jun 99 18:00:18 -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 Sat, 19 Jun 1999 Volume: 8 Number: 6061
Today's topics:
Re: ActiveState Perl and use of PPM (Erol Bernstein)
Re: ActiveState Perl and use of PPM <walton@frontiernet.net>
Re: Afraid to ask about Y2K! finsol@ts.co.nz
Re: Afraid to ask about Y2K! (Chris Nandor)
Re: Can Perl executables be compiled? <tchrist@mox.perl.com>
Re: Cron alternative? <tchrist@mox.perl.com>
Cure for document deficiency <tchrist@mox.perl.com>
Re: Cure for document deficiency <gellyfish@gellyfish.com>
Re: Cure for document deficiency <tchrist@mox.perl.com>
Re: File Processing <gellyfish@gellyfish.com>
function to read a line & return it <zjagrantz@znrcanz.gcz.ca>
Re: function to read a line & return it (Eric Bohlman)
Re: function to read a line & return it <rick.delaney@home.com>
Re: Perl and artificial intelligence. <gellyfish@gellyfish.com>
Re: perlcc in Unix <tchrist@mox.perl.com>
Re: simple question about array <tchrist@mox.perl.com>
Re: Simple question <revjack@radix.net>
Re: Sort (Andrew Johnson)
Re: Sort <gellyfish@gellyfish.com>
Urgent and important : CSV !!! <bruno.baguette@francemel.com>
Re: Urgent and important : CSV !!! (Andrew Johnson)
Re: Urgent and important : CSV !!! <revjack@radix.net>
virtualave.net <leonid76@erols.com>
Re: virtualave.net dalehend@flash.net
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 19 Jun 1999 23:11:59 GMT
From: erol.bernstein@owl-online.de (Erol Bernstein)
Subject: Re: ActiveState Perl and use of PPM
Message-Id: <376c209e.3868605@news.owl-online.de>
On 19 Jun 1999 19:12:00 -0000, Jonathan Stowe
<gellyfish@gellyfish.com> wrote:
>> What's a PPD-file?
>>
>
>A Perl Package Description (I believe) - you wont be able to simply
>do what you are attempting as the stuff in your original installation
>is not a valid Package - you might want to do:
>
>C:\> ppm install Tk
>
>Of course you will have to be connected to the 'net for that to work.
I tried it, checked the settings and was reading all help I've found
by ActiveState. But the result is after a few minutes online:
C:\>ppm
PPM interactive shell (0.9.6) - type 'help' for available commands.
PPM> install Tk.pm
Install package 'Tk.pm?' (y/N): y
Error installing package 'Tk.pm': Could not locate a PPD file for
package Tk.pm
PPM> quit
Quit!
C:\>
PPM> set
Commands will be confirmed.
Temporary files will be deleted.
Case-insensitive searches will be performed.
Package installations will continue if a dependency cannot be
installed.
Tracing info will not be written.
Screens will not pause.
Current PPD repository paths:
ActiveState Package Repository:
http://www.ActiveState.com/packages
Packages will be installed under: C:\Perl
Packages will be built under: D:\TEMP
PPM>
C:\>perl -V
[...]
Characteristics of this binary (from libperl):
Locally applied patches:
ActivePerl Build 515
Built under MSWin32
Compiled at Apr 9 1999 19:53:14
@INC:
C:\PERL\lib
C:\PERL\site\lib
>The documentation that comes with the activestate distribution explains
>how PPM works.
Yes, I've read it. But it doesn't work how it should.
Ok, I used the second way and added following statment to my script
use lib 'c:\perl\lib\site';
use Tk;
The result is only one ugly line :-(
Error: Parse exception
I searched 'perldiag' and some other perl documents, btw. very fine
documentation, tips and hints ... but I can't find these error
message.
please help
salute
erol
------------------------------
Date: Sat, 19 Jun 1999 20:51:11 -0400
From: Bob Walton <walton@frontiernet.net>
To: Erol Bernstein <erol.bernstein@owl-online.de>
Subject: Re: ActiveState Perl and use of PPM
Message-Id: <376C3AFE.FD0E3D4D@frontiernet.net>
Erol Bernstein wrote:
> Hello yours,
>
> ...
> Now, I tried to install these packages with 'ppm'-manager.
>
> PPM>install /location c:\perl\lib\site Tk.pm
>
> gives:
>
> Error installing package 'Tk.pm': Could not locate a PPD file for
> package Tk.pm
>
...
Erol, I've had the best luck with PPM by doing as follows:
1. Browse to http://www.activestate.com/packages/zips
2. Download the zip file for the package you want, like Tk.zip
3. Extract the zip file to a convenient place, like maybe c:\temp, being
sure to preserve the directory structure.
4. Issue the DOS command:
ppm "--location=c:\temp"
5. Then issue, in response to ppm's prompt:
install Tk
I have had intermittent unreliability problems with ppm over the net with
both Windows 95 and NT, but it has always worked well from a local
directory.
------------------------------
Date: Sat, 19 Jun 1999 22:46:08 GMT
From: finsol@ts.co.nz
Subject: Re: Afraid to ask about Y2K!
Message-Id: <7kh6jf$400$1@nnrp1.deja.com>
In article <376b4803.11350654@nntp.ix.netcom.com>,
Orlofsky(n.o. s.p.a.m, m.a.a.m.)@ix.netcom.com (Clifford Orlofsky)
wrote:
> >For some examples, check out the following URL:
> >http://www.idg.co.nz/WWWfeat/Y2000/ja190499.htm
> [snip]
>
> Quoting from the above (your) website:
>
> >Leap year: An application may have a requirement to determine whether
or not the year is a
> > leap year. Incorrect determination of a leap year can occur
where a programmer does not
> > know the leap year rules. A leap year is determined, in most
cases, by checking if the year is
> > evenly divisible by four. If it is, then the year is assumed
to be a leap year. This will give the
> > correct result for the year 2000. However, for the year 1900
this does not work and
> > therefore some calculations have had additional accuracy
added by determining whether the
> > year is the first year of a century by determining if it is
evenly divisible by 100. If so, then it is
> > assumed that the year is not a leap year. However, the first
year in a century is a leap year if it
> > is evenly divisible by 400 and some programmers have failed
to make this additional check.
> > Where the division by 100 test is performed but the division
by 400 check is not made, the
> > year 2000 will not be determined as being a leap year.
>
> What bothers me is the last sentence. Am I missing something here? If
> only the divide by 4 test and the divide by 100 test are performed,
> then the year 2000 WILL be "determined as being a leap year."
>
> The divide by 400 test would succeed for the year 2000 anyway. It's
> important for determining leap-ness for 1800, 1900, 2100, 2200, etc.
>
> Based on the way you've clumsily worded this example, you fooled
> yourself into writing that last line in error. Your own syntax has
> tripped you up. Does anyone proofread your web pages before they're
> posted? Wait. That would be a peer review. Nevermind.
>
> It's no wonder you're having a problem convincing people in this N.G.
>
I have read and re-read the paragraph I wrote and I still can't
understand why you consider it incorrect. The divide by 100 is used to
eliminate the Year 2000 as being a leap year. The divide by 400 is
required to determine whether it is the exception to the rule and to
re-include it. By all means, do correct me again if necessary if I am
wrong.
If you consider my wording clumsy, can you provide an alternative that
would be better understood? Perhaps then your argument would be clearer.
Jocelyn Amon
--
Financial Solutions Limited
http://www.ts.co.nz/~finsol/
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Sun, 20 Jun 1999 00:56:25 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Afraid to ask about Y2K!
Message-Id: <pudge-1906992056320001@192.168.0.77>
In article <B390349996689A6CBF@0.0.0.0>, rlb@intrinsix.ca (Lee) wrote:
# In article <pudge-1806991606350001@192.168.0.77>,
# pudge@pobox.com (Chris Nandor) wrote:
#
# ># Yet, wouldn't there be fewer Y2K problems in C and Perl programs
# ># if localtime() returned the full four digit year?
# >
# >Probably. But c'est la vie. I don't have an opinion on whether the
# >standard library should return years since 1900 or years since 0. I
# >support Perl using the standard library which happens to return years
# >since 1900.
#
# We're almost 30 years too late to make substantive design changes to
# localtime(). But even in the libraries, it would be nice to have something
# between localtime() and strftime(). A humantime() function, perhaps, that
# returned "real" years, and didn't zero-index days of the week and months of
# the year.
#
# In Perl, I *expect* to find the imaginary humantime() function. This is one
# of the few times it has left me disappointed.
Write your own. Here, I'll do it for you.
sub humantime {
my $time = defined $_[0] ? $_[0] : time;
if (wantarray) {
my @time = localtime $time;
$time[4] += 1;
$time[5] += 1900;
return @time;
} else {
return localtime $time;
}
}
I give anyone permission to put it in a module. I suggest Time::Human.
Or maybe Time::localtime::DWIM.
--
Chris Nandor mailto:pudge@pobox.com http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10 1FF77F13 8180B6B6'])
------------------------------
Date: 19 Jun 1999 17:06:07 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Can Perl executables be compiled?
Message-Id: <376c225f@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
claird@Starbase.NeoSoft.COM (Cameron Laird) writes:
:I agree that the most practical course now for those working with
:Perl is to distribute a standard Perl installation. I can see this
:changing, though, before long ...
Only when we reach the blessed state of ubiquity.
:What do you mean by "code generator" in this context?
Something that takes what the compiler produces and generates
code from this. Perl has three code generators.
--tom
--
Courage is the willingness of a person to stand up for his beliefs in the face
of great odds. Chutzpah is doing the same thing wearing a Mickey Mouse hat.
------------------------------
Date: 19 Jun 1999 17:32:20 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Cron alternative?
Message-Id: <376c2884@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
Jonathan Stowe <gellyfish@gellyfish.com> writes:
:On Sat, 19 Jun 1999 08:21:20 -0500 RLD wrote:
:You probably want to look for some manpage server on the net
PPT (Perl Power Tools @ http://language.perl.com/ppt/) has
references to both the BSD pages and the V7 ones. Actually,
you can even find V1 manpages from the main V7 index page.
--tom
--
"... the whole documentation is not unreasonably transportable in a
student's briefcase." - John Lions describing Unix 6th Edition
"This has since been fixed in recent versions." - Kernighan & Pike
------------------------------
Date: 19 Jun 1999 17:08:38 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Cure for document deficiency
Message-Id: <376c22f6@cs.colorado.edu>
I have an idea. When someone asks a questions that's in the standard
perl manpages, we'll all simply mail them the complete manpage. :-)
--tom
--
Emacs is a fine programming language, but I still prefer perl. -me
------------------------------
Date: 19 Jun 1999 23:41:02 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Cure for document deficiency
Message-Id: <7kh9qe$55k$1@gellyfish.btinternet.com>
On 19 Jun 1999 17:08:38 -0700 Tom Christiansen wrote:
> I have an idea. When someone asks a questions that's in the standard
> perl manpages, we'll all simply mail them the complete manpage. :-)
>
OK but does this include the various non-Perl manpages that might be
appropriate, the entire docset for Apache, the documentation for
various Microshite products involved in this collapse of world order -
I mean I'm in favour but we must have rules of engagement ...
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 19 Jun 1999 17:27:22 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Cure for document deficiency
Message-Id: <376c275a@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
Jonathan Stowe <gellyfish@gellyfish.com> writes:
:OK but does this include the various non-Perl manpages that might be
:appropriate, the entire docset for Apache, the documentation for
:various Microshite products involved in this collapse of world order -
:I mean I'm in favour but we must have rules of engagement ...
If it's on the computer, and they missed it, just mail them the
doc in toto, with a little note that it's on their computer
but they missed it so here's a duplicate. :-)
--tom
--
X-Windows: No hardware is safe.
--Jamie Zawinski
------------------------------
Date: 19 Jun 1999 23:25:14 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: File Processing
Message-Id: <7kh8sq$533$1@gellyfish.btinternet.com>
On 19 Jun 1999 20:55:00 +0200 Kai Henningsen wrote:
> abigail@delanet.com (Abigail) wrote on 16.06.99 in <slrn7mfcle.do2.abigail@alexandra.delanet.com>:
>
>> Wyzelli (wyzelli@yahoo.com) wrote on MMCXV September MCMXCIII in
>> <URL:news:ymH93.12$E4.15259@vic.nntp.telstra.net>:
>> &&
>> && It's amazing what I can learn just by following some of these threads...
>>
>>
>> But it's even more amazing that this thread doesn't answer the question
>> originally asked.
>
> Well, the first (one article, Bart) subthread I see does. (For me, this is
> the second (very long, started by Jonathan) subthread. And your
> explanation is the last (one article) subthread.)
>
For some reason about half of Abigails posts dont get here - but yes I
started a subthread on the supposition that it was the misuse of local
that was at wuestion here alongside the false logic in the loop. Of
course I missed the list context thing ...
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sat, 19 Jun 1999 19:14:22 -0400
From: "John A. Grant" <zjagrantz@znrcanz.gcz.ca>
Subject: function to read a line & return it
Message-Id: <7kh8b8$2kf4@nrn2.NRCan.gc.ca>
I'm experienced in C/C++, but I'm a bit disoriented in
Perl. I've written a function that will read a non-blank,
non-commented line of text and return it:
sub ReadLine{
LINE:
while(<FILE>){
next LINE if /^#/;
next LINE if !m/\S/;
chop;
return $_;
}
return undef; # or "" or what?
}
Questions
1. what should I return if it hits EOF?:
- undef?
- ""
- something else?
2. how do I test for ReadLine() failure, i.e. EOF? I've tried:
(a) returning undef and testing for it:
$x=ReadLine();
done if($x==undef);
(b) returning "" and testing for it:
$x=ReadLine();
done if($x=="");
None of these seem to work. In case b(), when returning "",
sure enough when I print $x, it contains "", so why can't I
test for it?
Thanks.
--
John A. Grant * I speak only for myself * (remove 'z' to reply)
Airborne Geophysics, Geological Survey of Canada, Ottawa
If you followup, please do NOT e-mail me a copy: I will read it here
------------------------------
Date: Sun, 20 Jun 1999 00:41:53 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: function to read a line & return it
Message-Id: <ebohlmanFDLoLt.84A@netcom.com>
John A. Grant (zjagrantz@znrcanz.gcz.ca) wrote:
: I'm experienced in C/C++, but I'm a bit disoriented in
: Perl. I've written a function that will read a non-blank,
: non-commented line of text and return it:
:
: sub ReadLine{
: LINE:
: while(<FILE>){
: next LINE if /^#/;
: next LINE if !m/\S/;
: chop;
Better to use chomp here
: return $_;
: }
: return undef; # or "" or what?
: }
:
: Questions
: 1. what should I return if it hits EOF?:
: - undef?
: - ""
: - something else?
It really depends on who's going to be calling it. undef has the
advantage of being "out of band"; it can never be confused with something
you might actually return. "" would be a reasonable value given that
you're currently skipping blank lines, but if you subsequently had to
change that (or wanted to use the routine in an application where you
*did* need to return blank lines, probably by adding a parameter
specifying whether blank lines were allowed), you'd have to go to
something out-of-band anyway, and you'd have to change all the code that
called your routine.
So I'd say undef is the most reasonable answer.
:
: 2. how do I test for ReadLine() failure, i.e. EOF? I've tried:
: (a) returning undef and testing for it:
: $x=ReadLine();
: done if($x==undef);
The proper way to test if a value is defined is to call defined() on it:
done unless defined($x);
:
: (b) returning "" and testing for it:
: $x=ReadLine();
: done if($x=="");
Perl has separate comparison operators for string equality and numeric
equality (this is because a Perl scalar can be treated as either a string
or a number; there's no strong typing). "==" tests numeric equality;
"eq" tests string equality. A string that doesn't start with a digit has
a value of 0 when treated as a number. The problem in your code is that
unless $x starts with a digit, it will have the value 0 in a numeric
comparison, as will "", so the if modifier will always evaluate true for
lines that don't start with a digit.
Take a look at the section on comparison operators in perlop.
[Note to other regulars: I'm going easy on John because I've seen his
valuable contributions in c-related groups and I know that he's no script
kiddie]
------------------------------
Date: Sun, 20 Jun 1999 00:58:09 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: function to read a line & return it
Message-Id: <376C3C67.1E3B726E@home.com>
John A. Grant wrote:
>
> I'm experienced in C/C++, but I'm a bit disoriented in
> Perl. I've written a function that will read a non-blank,
> non-commented line of text and return it:
>
> sub ReadLine{
> LINE:
> while(<FILE>){
> next LINE if /^#/;
> next LINE if !m/\S/;
^^^^
Cast off those C shackles. This could also be written
next LINE unless /\S/;
Okay, that's just a personal preference. You might prefer less typing.
/\S/ or next;
perldoc perlsyn
perldoc perlop
> chop;
It'd be better to use chomp here.
perldoc -f chomp
> return $_;
> }
> return undef; # or "" or what?
> }
>
> Questions
> 1. what should I return if it hits EOF?:
> - undef?
Yes, assuming you really want to use a subroutine for this. But don't
say
return undef;
because a plain
return;
will serve you better as a general rule.
perldoc -f return
perldoc perlsub
> 2. how do I test for ReadLine() failure, i.e. EOF? I've tried:
> (a) returning undef and testing for it:
> $x=ReadLine();
> done if($x==undef);
You're using the wrong operator. To test for definedness, use defined.
done if defined $x;
or just
done if defined ReadLine();
perldoc -f defined
> (b) returning "" and testing for it:
> $x=ReadLine();
> done if($x=="");
You're using the wrong operator again. "" is a string, not a number.
done if $x eq "";
perldoc perlop
--
Rick Delaney
rick.delaney@home.com
------------------------------
Date: 19 Jun 1999 23:33:02 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Perl and artificial intelligence.
Message-Id: <7kh9be$53d$1@gellyfish.btinternet.com>
On Sat, 19 Jun 1999 21:35:36 GMT dwolfe5272@my-deja.com wrote:
> In article <376AFCA9.A4EE3ECD@inetnebr.com>,
> ktb <xyf@inetnebr.com> wrote:
>> Hi, I've been searching for something on the net about artificial
>> intelligence using the Perl language. Most of the programs seem to be
>> in 'C' and other languages I haven't heard of. I'm new to programming
>> but I thought it would be fun to mess around with this.
>
> I don't know about perl AI tools, but perhaps you've heard of SOAR, an
> agent-based system that uses Tcl? In case you haven't, the home page
> is:
But hey we werent about to be recommending something like that were we ;-}
/J\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 19 Jun 1999 17:30:08 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: perlcc in Unix
Message-Id: <376c2800@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
Jukka Juslin <jukka.juslin@cern.ch> writes:
:Anyway if you edit the C code you can get it work e times faster than
:pure Perl code (according to Tom Christiansen) =).
No, that's wrong. Raw C code is often no more than e times faster
than raw Perl code, given skilled coding. But the code generator
produces C code that seldom gives you more than a 10% speed-up.
It's almost never worth it, for reasons I won't bother going into.
Hoardware is evil.
--tom
--
"I just hope I'm never promoted to the level of my incontinence."
--Larry Wall
------------------------------
Date: 19 Jun 1999 17:43:08 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: simple question about array
Message-Id: <376c2b0c@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
Jonathan Stowe <gellyfish@gellyfish.com> writes:
:But yes I'm not always right, but I am pretty sure that Learning Perl
:doesnt say that (6.1 .. 99.3) will produce anything but a bunch of integers.
It does, and it's wrong.
--tom
--
What's the difference between Country music and Western music? Well,
Country is about getting drunk, feeling sorry for yourself, and hitting
on your neighbor's wife. Western, on the other hand, is about riding
the range, wide open spaces, and hitting on your neighbor's sheep.
------------------------------
Date: 20 Jun 1999 00:05:30 GMT
From: Garry Miriam <revjack@radix.net>
Subject: Re: Simple question
Message-Id: <7khb8a$loe$1@news1.Radix.Net>
Keywords: Hexapodia as the key insight
Jonathan Stowe explains it all:
:On 19 Jun 1999 20:53:15 GMT Serpens Mayo wrote:
:> I'll be danged. I thought you had to 'use Socket' for gethostbyaddr() to
:> work. Thank you for posting this code.
:No gethostbyaddr is a Perl builtin - however if you want to avoid using
:a hard coded constant or wish to use a helper function such as inetaton
:that will ensure that the translation between a character representation
:of an IP address is done properly in face of a change in the underlying
:representation (I'm thing IPv6 here ) you should use Socket.pm. Socket.pm
:is part of the standard Perl distribution - if you are unable to use then
:the perl that you are using is simply broken and should be reinstalled.
My workstation install, and that at my ISP, are fine. I erroneously
inferred from David's code that Socket.pm was not needed *at all* for
using gethostbyaddr(). My fault for assuming. I appreciate your
clarification, thank you.
:I dont understand why there should be any resistance against using Socket.pm
:- would you similarly rail against including 'sys/socket.h' in a C
:program that was doing the same thing ?
I don't have any resistance against using Socket.pm. I'm just *asking*. :)
------------------------------
Date: Sat, 19 Jun 1999 23:00:46 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: Re: Sort
Message-Id: <yiVa3.6136$36.127201@news2.rdc1.on.home.com>
In article <7kh50g$7ac$1@news.monmouth.com>,
Matt <splinter@monmouth.com> wrote:
! Hi,
!
! I ran a sort on a series of numbers...specifcally
!
! 100, 101, 123, and 55
!
! They were in the order 101, 100, 123, 55
! After they were sorted: 100, 101, 123, 55
!
! Why didn't the 55 come first?
!
! I did look in the perldoc and the perlfaq but I couldn't find it...sorry if
! it may still be in there.
hmm, when look in the perlfunc manpage for sort(), (perldoc -f sort),
the first two sentences say this:
Sorts the LIST and returns the sorted list value. If SUBNAME or
BLOCK is omitted, C<sort()>s in standard string comparison order.
and later in the same description are several examples of sort()
including sorting numerically --- perhaps you should go back and
read the docs on sort() a little more carefully.
regards
andrew
------------------------------
Date: 19 Jun 1999 23:31:51 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Sort
Message-Id: <7kh997$53a$1@gellyfish.btinternet.com>
On Sat, 19 Jun 1999 18:17:05 -0400 Matt wrote:
> Hi,
>
> I ran a sort on a series of numbers...specifcally
>
> 100, 101, 123, and 55
>
> They were in the order 101, 100, 123, 55
> After they were sorted: 100, 101, 123, 55
>
> Why didn't the 55 come first?
>
> I did look in the perldoc and the perlfaq but I couldn't find it...sorry if
> it may still be in there.
>
The perlfunc entry *does* explain this but perhaps a little obliquely for
some tastes - the default sort is *lexical* thus the results you are
getting are what is to be expected : if you want numeric sort then you
will have to supply your own sortsub using the space-invader operator
(<=>) rather than the default cmp.
There is also a section in perlfaq4 that discusses several issues regarding
sorting ...
/j\
--
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sat, 19 Jun 1999 23:28:16 GMT
From: Bruno Baguette <bruno.baguette@francemel.com>
Subject: Urgent and important : CSV !!!
Message-Id: <7kh929$4lj$1@nnrp1.deja.com>
I have to present an examination in 4 days...
At this examination, i have to present a perl script wich read a file
called data.txt...
In this file, there is a database in CSV format, and the data is like
this :
firstname;lastname;country
And the perl script has to read the file data.txt and display all the
record where the firstname is "Bill"...
Please, help me !
I'm looking for that script !
Please mail me this script, or an url, to bruno.baguette@francemel.com
It's very important to me !
Thanks in advance !
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Sun, 20 Jun 1999 00:44:51 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: Re: Urgent and important : CSV !!!
Message-Id: <7QWa3.8$36.2278@news2.rdc1.on.home.com>
In article <7kh929$4lj$1@nnrp1.deja.com>,
Bruno Baguette <bruno.baguette@francemel.com> wrote:
! I have to present an examination in 4 days...
!
! At this examination, i have to present a perl script wich read a file
! called data.txt...
so you'd best get cracking at writing it...
! In this file, there is a database in CSV format, and the data is like
! this :
!
! firstname;lastname;country
!
! And the perl script has to read the file data.txt and display all the
! record where the firstname is "Bill"...
you should be able to write such a script in 4 days...
! Please, help me !
perldoc perl
perldoc perlsyn
perldoc perlfaq
perldoc perlop
perldoc perlfunc
! I'm looking for that script !
we don't have the script you are looking for...you'd
best start writing it yourself...
! It's very important to me !
but not important enough to try to do your own work?
That's too bad...Good luck with your exam though.
regards
andrew
------------------------------
Date: 20 Jun 1999 00:47:13 GMT
From: Wappinger Bailey <revjack@radix.net>
Subject: Re: Urgent and important : CSV !!!
Message-Id: <7khdmh$qlp$2@news1.Radix.Net>
Keywords: Hexapodia as the key insight
Bruno Baguette explains it all:
:I have to present an examination in 4 days...
This is very funny. I've seen this group's residents espouse the "We're
not here to do your homework for you" paradigm frequently, but I never
thought it would apply literally...
------------------------------
Date: Sat, 19 Jun 1999 19:15:38 -0400
From: "Leonid Goltser" <leonid76@erols.com>
Subject: virtualave.net
Message-Id: <7kh883$avf$1@autumn.news.rcn.net>
Somebody suggested me to upload my scripts on virtualave.net. I did but my
scripts do not work (although, they work perfectly on my machine). Browser
can't open them. If somebody use virtualave.net, can you help me? Probably
something wrong with configuration or something else. If you run your
scripts on that server, please, give me a piece of your code what works
there. I'll use it as an example.
------------------------------
Date: Sun, 20 Jun 1999 00:29:28 GMT
From: dalehend@flash.net
Subject: Re: virtualave.net
Message-Id: <376c35ea.22571746@news.flash.net>
Search on virtualave.net in this newsgroup
On Sat, 19 Jun 1999 19:15:38 -0400, "Leonid Goltser"
<leonid76@erols.com> wrote:
>Somebody suggested me to upload my scripts on virtualave.net. I did but my
>scripts do not work (although, they work perfectly on my machine). Browser
>can't open them. If somebody use virtualave.net, can you help me? Probably
>something wrong with configuration or something else. If you run your
>scripts on that server, please, give me a piece of your code what works
>there. I'll use it as an example.
>
>
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 6061
**************************************