[13203] in Perl-Users-Digest
Perl-Users Digest, Issue: 613 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Aug 22 04:07:15 1999
Date: Sun, 22 Aug 1999 01:05:07 -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 Sun, 22 Aug 1999 Volume: 9 Number: 613
Today's topics:
Re: Array, Subroutine question (Abigail)
Re: Array, Subroutine question (Abigail)
Re: DWIM redux (Was: Why use Perl when we've got Python (Abigail)
How to do "or" in IF test? (Jim)
Re: Pattern Match - Don't Understand this particular on (Michael Budash)
Perl puzzle: array of booleans to ranges (Bart Lateur)
Re: Tom Christiansen "Perl Cookbook" (Abigail)
Re: trim code (Abigail)
URGENT: Freelance perl coder required <tonyd@kellion.demon.co.uk>
Re: vacation doesn't work with domain name. Alternative (Abigail)
Re: What does gmtime[3,4,5] do? (Abigail)
Re: What editors are folks using for PerlScript develop (Abigail)
Re: while loop teminates too early (Abigail)
Re: Why use Perl when we've got Python?! <xah@best.com>
Re: Why use Perl when we've got Python?! <xah@best.com>
Re: Why use Perl when we've got Python?! <xah@best.com>
Re: Why use Perl when we've got Python?! <xah@best.com>
Re: Why use Perl when we've got Python?! (Abigail)
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 22 Aug 1999 01:16:01 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Array, Subroutine question
Message-Id: <slrn7rv5en.c9p.abigail@alexandra.delanet.com>
Ronald J Kimball (rjk@linguist.dartmouth.edu) wrote on MMCLXXVII
September MCMXCIII in <URL:news:1dwnmun.15dr7v1dp3vupN@p183.tc2.state.ma.tiac.com>:
.. Bart Lateur <bart.lateur@skynet.be> wrote:
..
.. > soccerreferee@hotmail.com wrote:
.. >
.. > > @friends = qw(Peter Paul Mary Jim Tim);
.. > > ($this, $that) = shift2(@friends);
.. > >
.. > > sub shift2 (\@) {
.. > > return splice(@{$_[0]}, 0, 2);
.. > > }
.. > >
.. > >I have tried to run the code, but $this and $that come back as null,
.. > >and @friends remains unchanged.
.. >
.. > Euh... Shouldn't you switch the order? I.e. define the sub *first*, and
.. > put the sub call below that.
..
.. Did you try it both ways?
..
.. Doesn't matter, because the subroutine is being called with parentheses
.. around the arguments, which tells perl that it is, indeed, a subroutine
.. call. It happily assumes that the subroutine will be declared later in
.. the compilation process. If it isn't, you get a runtime error.
Well, it does matter, but not in the way Bart says. What matter is the
function *prototype*.
Abigail
--
perl -wlne '}for($.){print' file # Count the number of lines.
-----------== 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: 22 Aug 1999 01:18:12 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Array, Subroutine question
Message-Id: <slrn7rv5is.c9p.abigail@alexandra.delanet.com>
Ronald Goeggel (r.goeggel@atos-group.de) wrote on MMCLXXVIII September
MCMXCIII in <URL:news:7pehit$rmv$1@news.pop-stuttgart.de>:
::
:: I don't know anything about prototyping
:: But, how goes up here:
::
:: #!/usr/local/bin/perl -w
:: @a = (1, 2, 3, 4);
::
:: &foo(@a);
:: foo(@a);
:: sub foo (\@) { print join('+', @_), "\n" }
:: &foo(@a);
:: foo(@a);
::
:: -------------------------
:: 1+2+3+4
:: 1+2+3+4
:: 1+2+3+4
:: ARRAY(0x80df764)
RTFM.
&sub (args) bypasses any prototype checking and context forcing.
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
.qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
.qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'
-----------== 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: 22 Aug 1999 02:36:51 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: DWIM redux (Was: Why use Perl when we've got Python?!)
Message-Id: <slrn7rva69.c9p.abigail@alexandra.delanet.com>
Sam Holden (sholden@staff.cs.usyd.edu.au) wrote on MMCLXXX September
MCMXCIII in <URL:news:slrn7rpluc.9sg.sholden@staff.cs.usyd.edu.au>:
== On 20 Aug 1999 04:00:21 GMT, kj0 <kj0@mailcity.com> wrote:
== >In <37b30253@cs.colorado.edu> Tom Christiansen <tchrist@mox.perl.com> writes:
== >
== >>Another principle underlying much of Perl is that "things that
== >>act different should look different". This allows you to write
== >>programs in Perl that are *easier* to read, because different things
== >>don't look like each other. Python tends to obscure this.
== >
== >>For example, that's one reason why when you want numeric ordering you
== >>use "==", but when you want lexical ordering you use an operator that
== >>looks completely different: "eq". Likewise, because an array and a hash
== >>are, despite their interconvertibility, fundamentally different things,
== >>they *look* different.
== >
== >This runs counter to the whole DWIM thing... There's nothing DWIM about:
== >
== > DB<1> print "dog" == "cat"
== >1
==
== That does exactly what IM.
==
== >Conversely, one could argue that integer and float arithmetic is a
== >different beasts, so that it is proper that they should look
== >different:
== >
== > 3/4 vs. float(3)/float(4)
==
== DWIM with numbers to me means treat them as numbers. Not as integers or
== floats. If I asked someone what 3 divided by 4 was, they would say 3/4
== or 0.75. They would not say 0.
==
== 3/4 == 0 is a restriction to intergers, since no restriction is needed,
== it shouldn't apply. Of course if I want to use integer math I can, and
== if I want the interger answer I can get that too. Since they are
== less likely what I want I have to add an 'int' here or there.
If I do "integer math", I would expect 3/4 to raise an exception (Python)
or a fatal warning (Perl). We all know that the field of integers isn't
closed under division, and pretending it is, is just plain stupid.
Having 3/4 == 0, whether with "integer math" or not, breaks the equivalence:
p == f1 * f2 iff p == f2 == 0 /\ p/f2 == f1.
==
== >
== >DWIM implies that the language will deal with multiple interpretations
== >whereas "things that act different should look different" leaves the
== >resolution of these possible interpretations to the programmer;
== >i.e. these two principles tug in opposite directions.
==
== I see no contridiction. DWIM implies that hopefully in the majority of cases
== a construct will do what the author meant. Things that act different looking
== different implies you can tell what is going to happen by how it looks.
==
== $tim = $fred + $bill;
==
== Has a well defined meaning in perl (ignoring operator overloading which since
== it is not as trivial as in C++, is not overused so much in perl). It adds
== $fred and $bill as numbers (converting to numbers if necessary) and stores
== the result in $tim).
==
== If I want to concatenate the strings $fred and $bill I don't use +. If I did
== then the same code would do vastly different things depending on the values
== of $fred and $bill.
==
== They look different because they are different.
Like | and |? And like & and &? Also, consider .. and .. - see the
difference based on the type of the arguments?
Abigail
--
perl -e '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %;
BEGIN {% % = ($ _ = " " => print "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: Sun, 22 Aug 1999 03:48:01 -0500
From: jkrogerDONCHA_SPAM_ME@earthlink.net (Jim)
Subject: How to do "or" in IF test?
Message-Id: <jkrogerDONCHA_SPAM_ME-2208990348020001@ip210.princeton.nj.pub-ip.psi.net>
Please accept my apologies if this is not the appropriate
place for this question.
I am learning Perl using "Learning Perl" (great book). I am not
able to find info on how to implement a logical OR in an if
statement test, such as
if (this or that) {
-
-
-
}
I tried several permutations such as
if ((this) || (that))
if ( this || that )
if (this) || (that)
and nothing seemed to work.
The actual tests are
end <= 20
answer eq "y"
Thanks for any help.
Jim
------------------------------
Date: Sat, 21 Aug 1999 23:35:22 -0700
From: mbudash@sonic.net (Michael Budash)
Subject: Re: Pattern Match - Don't Understand this particular one
Message-Id: <mbudash-2108992335220001@adsl-216-103-91-123.dsl.snfc21.pacbell.net>
In article <7pnpul$5b9$1@news.monmouth.com>, "Matt"
<splinter@monmouth.com> wrote:
>Hi,
>
>I have this pattern match that grabs the file name out of a path name...for
>instance if you have a string that says:
>
>C:\windows\desktop\thing.jpg
>
>This pattern should grab just "thing.jpg" and it does but I don't understand
>FULLY why and am asking for a little help if anyone doesn't mind.
>
>/([^\/\\]+)$/
>
>So the ( ) just reserves the stuff in there into variable $1 for later...
yes, in this case...
>But in English this says what? Take the end of the string ($) up to (+) a
>part where it begins with a / or a \ (^).
>Am I translating that correctly? Anyone like to clear this up?
it says:
match the longest possible substring of one or more non-forward-slash,
non-backslash characters that occurs just before the end of the string in
question, and put it (the substring) into $1
--
| Michael Budash Consulting | 707-252-7670 voice |
| Perl, Javascript, PHP, MySQL | 603-250-8679 fax |
| Official Extropia Developer | mbudash@sonic.net |
------------------------------
Date: Sun, 22 Aug 1999 07:07:21 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Perl puzzle: array of booleans to ranges
Message-Id: <37bf9c06.1651265@news.skynet.be>
OK, here's a cute little coding problem. The aim is the opposite of
obfuscation: make the code as clear as possible; and a variation on Perl
Golf: fewer Perl tokens ("words", not keystrokes) is better. For
example, "print $x+123" is 4 tokens: ("print", "$x", "+", "123").
Problem: convert an array of booleans to a list/array of ranges of where
the boolean is true.
from: @boolean = (1, 1, 0, 1, 1, 1, 0, 0, 1);
to: @result = ([0, 2], [3,3], [8, 1]);
In the result, the first number is the starting index, the second number
the number of consecutive true values.
I have a few ideas of my own, I'll post my attempts in a follow-up.
Bart.
------------------------------
Date: 22 Aug 1999 01:08:53 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Tom Christiansen "Perl Cookbook"
Message-Id: <slrn7rv51d.c9p.abigail@alexandra.delanet.com>
-Sneex- (bill@fccj.org) wrote on MMCLXXIII September MCMXCIII in
<URL:news:120819992122022396bill@fccj.org>:
[] [[ This message was both posted and mailed: see
[] the "To," "Cc," and "Newsgroups" headers for details. ]]
What To and Cc headers are you refering to? (And that's 'To' or 'To:',
but never 'To,'.
(Besides, how relevant is that line about posting and mailing to the
Usenet public? A real newsreader would put such a line only on the
email, not the posting.)
Abigail
--
sub camel (^#87=i@J&&&#]u'^^s]#'#={123{#}7890t[0.9]9@+*`"'***}A&&&}n2o}00}t324i;
h[{e **###{r{+P={**{e^^^#'#i@{r'^=^{l+{#}H***i[0.9]&@a5`"':&^;&^,*&^$43##@@####;
c}^^^&&&k}&&&}#=e*****[]}'r####'`=437*{#};::'1[0.9]2@43`"'*#==[[.{{],,,1278@#@);
print+((($llama=prototype'camel')=~y|+{#}$=^*&[0-9]i@:;`"',.| |d)&&$llama."\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: 22 Aug 1999 01:23:38 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: trim code
Message-Id: <slrn7rv5t2.c9p.abigail@alexandra.delanet.com>
Jimtaylor5 (jimtaylor5@aol.com) wrote on MMCLXXIV September MCMXCIII in
<URL:news:19990814113145.15476.00000769@ng-fh1.aol.com>:
** Newbe question!
** This works, but I'm trying to find a simpler way of matching and incrementing
** sales, hits, whatever, in each month, without all this embarassingly ugly code.
** I've tried and failed. Does anyone know of a better way. The $mon_it variable
** being the current month, and the month variables holding the numbers. Help me
** or shoot me and put me out of my misery :)
**
my @months = qw /Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec/;
local $" = "|";
$counts {$1} ++ while $line =~ /\b(@months)\b/og;
Abigail
--
perl -wlne '}for($.){print' file # Count the number of lines.
-----------== 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: Sun, 22 Aug 1999 08:58:02 +0100
From: "Tony Dillon" <tonyd@kellion.demon.co.uk>
Subject: URGENT: Freelance perl coder required
Message-Id: <935308579.5212.0.nnrp-12.9e987314@news.demon.co.uk>
I have a couple of small Perl scripts I need written immediately. Nothing
too complicated, but tight deadlines mean that I don't have the time to
write them myself.
I need:
a) A script to parse a CSV file into a table. The CSV is located on another
server.
b) A script to create a straight HTML menu of text files in a folder, using
the first line of each file to create the menu headings, and then generate a
HTML page using the se;ected text file.
For more info, please contact me direct at either:
tdillon@tdmultimedia.com
or
tony@tonydillon.com
------------------------------
Date: 22 Aug 1999 01:41:02 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: vacation doesn't work with domain name. Alternative in Perl?
Message-Id: <slrn7rv6tm.c9p.abigail@alexandra.delanet.com>
Neil (neil@pacifier.com) wrote on MMCLXXXI September MCMXCIII in
<URL:news:37be6555.0@news.pacifier.com>:
// I wanted to use the unix utility "vacation".
And your Perl question is?
Abigail
--
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
"\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
"\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'
-----------== 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: 22 Aug 1999 01:57:37 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: What does gmtime[3,4,5] do?
Message-Id: <slrn7rv7sp.c9p.abigail@alexandra.delanet.com>
John M. Dlugosz (john@dlugosz.com) wrote on MMCLXXVIII September MCMXCIII
in <URL:news:2E4E840F164BDED4.A1DBB8413B3072E1.FDAFCE9A56832023@lp.airnews.net>:
'' When I wrote
'' my ($d,$m,$y) = gmtime [3,4,5];
''
'' I got 52, 52, 7. Now the value 7 is found at subscript 4 from the original
'' list, but 52 is not found anywhere, in the return value from gmtime, so
'' where is this number coming from?
It takes [3, 4, 5] and passes that as an argument to gmtime. And [3, 4, 5]
in numerical context is a valid number; hence some (but bogus) result
from gmtime, and no warnings.
my ($x, $y, $z) = (gmtime) [3, 4, 5];
That should do what you want.
Abigail
--
srand 123456;$-=rand$_--=>@[[$-,$_]=@[[$_,$-]for(reverse+1..(@[=split
//=>"IGrACVGQ\x02GJCWVhP\x02PL\x02jNMP"));print+(map{$_^q^"^}@[),"\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: 22 Aug 1999 02:00:56 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: What editors are folks using for PerlScript development?
Message-Id: <slrn7rv830.c9p.abigail@alexandra.delanet.com>
Keith G. Murphy (keithmur@mindspring.com) wrote on MMCLXXX September
MCMXCIII in <URL:news:37BDB444.F186EBF4@mindspring.com>:
() Mike wrote:
() >
() > my editor of preference is vi. there is an initial learning curve that many
() > people absolutely hate and is why many don't and won't use it. (WUSSIES :o
() > ). but when you take the time to learn it.... it is much much faster than a
() > editor that uses a mouse. HANDS DOWN.
() ^^^^^^^^^^
() Yes, that is *exactly* it! (Did you realize the aptness of this when
() you wrote it? A poet once told me, "Always take credit for your
() intuition!")
Actually, I do use a mouse in combination with 'vi'. Selecting some
text from some other part of the desktop and cut and pasting it, beats
(re)typing it HANDS DOWN.
Abigail
--
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi
-----------== 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: 22 Aug 1999 02:06:24 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: while loop teminates too early
Message-Id: <slrn7rv8d8.c9p.abigail@alexandra.delanet.com>
Matt Curtin (cmcurtin@interhack.net) wrote on MMCLXXV September MCMXCIII
in <URL:news:xlxu2q12izv.fsf@gold.cis.ohio-state.edu>:
$$
$$ Do you think it is reasonable to consider the number 0 to be false?
$$
$$ If not, why?
$$
$$ If so, how do you propose telling the difference between "0" and 0?
$$ Perl, after all, is a late-typing language, and whether you've got a
$$ string or an integer cannot be determined until you apply some
$$ operation to it (like eq or ==). In fact, the very same thing can be
$$ an integer in one case and a string in another.
You think that's a reasonable argument?
Good. Now, please use that reasoning and explain to me why 0.0 is false,
and "0.0" is true.
Abigail
--
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi
-----------== 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: Sat, 21 Aug 1999 23:04:53 -0700
From: "Xah" <xah@best.com>
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <37bf9306$0$17002@nntp1.ba.best.com>
----------
>From: Tom Christiansen <tchrist@mox.perl.com>
>Newsgroups: comp.lang.perl.misc
>Subject: Re: Why use Perl when we've got Python?!
>Date: 1999, Aug 13, , 2:26 PM
>
> [courtesy cc of this posting mailed to cited author]
>
> In comp.lang.perl.misc,
> "John W. Stevens" <jstevens@basho.fc.hp.com> writes:
> :Due to this feature alone, Python programs are easier to read by
> :non-authors than Perl programs are.
>
> Prove that. Stop asserting it. Prove it.
You mean a mathematical proof??? Oh, stop, my brain hurts.
> Here's your challenge. Pick a Perl programmer with experience equivalent
> to mine, and show me their code. I'm sure I'll find it perfectly legible.
> I say this for certain because I *do* read their code, and it's completely
> easy to do so.
Agreed. You can read my code.
> If you're talking about someone who can't stop treating Perl like
> BASIC or FORTRAN, and just doesn't `get' it, then sure, it's unnatural.
> But that's hardly my fault that they don't know Perl, now is it?
Is it Larry's fault then? You know, the philosophy of Larry Perl is that
anyone and everyone can and should use it, and no, you don't have to swallow
the whole thing in one gulping blowjob, but nibble in pieces and savor it.
Yes it's irregular, but the enjoyment is the key. If you either ram it down
script kiddies' throats or forbid them doing it, then aren't you like the
python, constricting newbies to deaths?
> --tom
> --
> Hey, I had to let awk be better at *something*... :-)
> --Larry Wall in <1991Nov7.200504.25280@netlabs.com>1
Xah
xah@best.com
http://www.best.com/~xah/PageTwo_dir/more.html
"I think I'll side with the pissheads on this one." --Larry from Tommy
------------------------------
Date: Sat, 21 Aug 1999 23:05:23 -0700
From: "Xah" <xah@best.com>
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <37bf9325$0$17002@nntp1.ba.best.com>
----------
>From: Tom Christiansen <tchrist@mox.perl.com>
>Newsgroups: comp.lang.perl.misc
>Subject: Re: Why use Perl when we've got Python?!
>Date: 1999, Aug 13, , 4:51 PM
>
> [courtesy cc of this posting mailed to cited author]
>
> In comp.lang.perl.misc,
> "John W. Stevens" <jstevens@basho.fc.hp.com> writes:
> :OTOH, Python is perfect for the OO trained programmer who is part of
> :a team, or where the code will have to be maintained over a long
> :period of time by many different people.
>
> As is Perl. A sound Perl OO module designed by a competent programmer
> is certainly up to fitting that bill. A CGI monstrosity from a
> script kiddie isn't, but this is irrelevant.
uhh, Tommy, in your expert opinion, does the monstrosity of CGI.pm imply
that the author Lincoln Stein is a script kiddie?
Perhaps you are not aware of any monstrosity in CGI.pm? If that's the case,
I wouldn't be surprised. I fully aware that Perl can transparently alter
one's brain to tofu, but I humbly admit that I am not there yet.
> --tom
> --
> "Without knowing what I am and why I am here, life is impossible."
> - Leo Tolstoy
Xah
xah@best.com
http://www.best.com/~xah/PageTwo_dir/more.html
"Love is what we need"
- Perl script kiddie
------------------------------
Date: Sat, 21 Aug 1999 23:05:40 -0700
From: "Xah" <xah@best.com>
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <37bf9347$0$17002@nntp1.ba.best.com>
----------
>From: Tom Christiansen <tchrist@mox.perl.com>
>Newsgroups: comp.lang.perl.misc
>Subject: Re: Why use Perl when we've got Python?!
>Date: 1999, Aug 13, , 4:55 PM
>
> [courtesy cc of this posting mailed to cited author]
>
> In comp.lang.perl.misc,
> "John W. Stevens" <jstevens@basho.fc.hp.com> writes:
> :Understanding somebody elses Perl. . . now that can be heart breakingly
> :difficult.
>
> Then they were a bad Perl programmer, or else you are. Perl doesn't force
> you to write good code any more than English forces to write good prose.
> When you find bad prose, whom do you shoot? The writer, not the language.
> So, too, with Perl.
>
> If it is counted against Perl fault that "stupid" people can program in
> Perl, then so be it. This aspect has made many people's lives better,
> even if they are too "stupid" or too "inexperienced" for a "real
> programming language". They got their job done, and they're happy.
> I doubt you want to maintain their code, but why did you hire someone to
> write professionally maintainable code who had no demonstrated ability
> to do so?
Yes. Analogously, when you find a society full of heinous crimes, whom do
you shoot? The illegal immigrants, of course, not the system. So, too, with
Perl.
If it is counted against system's fault that brews these desperate or warped
criminals, then so be it. This aspect has made many people's lives better,
that it's extremely easy to obtain a gun or bomb for party, not to mention
the wealthy criminals in suits. They got their job done, and they're happy.
I doubt you want to take over their rolls, but why do you create a social
system that encourages these problems anyway?
> --tom
> --
> "The past was erased, the erasure was forgotten, the lie became truth."
> -- George Orwell, 1984
Xah
xah@best.com
http://www.best.com/~xah/PageTwo_dir/more.html
perl5 -e'print "just another f@%k?#& obfuscated hacker.\n"'
------------------------------
Date: Sat, 21 Aug 1999 23:07:03 -0700
From: "Xah" <xah@best.com>
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <37bf9399$0$215@nntp1.ba.best.com>
----------
>From: Tom Christiansen <tchrist@mox.perl.com>
>Newsgroups: comp.lang.perl.misc
>Subject: Re: Why use Perl when we've got Python?!
>Date: 1999, Aug 13, , 5:00 PM
>
>>...
>
> Wrong. I can assure you that not falling into the OO trap is considered
> a strength not a weakness. You obviously have been under the altar
> sipping at the communion wine at the Church of the Holy Object, whose
> credo is "I am Object -- the way, the truth, and the light. Let no man
> come unto his data save through Me."
>
> Thank you, but Perl isn't going to force such idolatry down anyone's
> throat, and the fact that it doesn't force them down on their knees
> in worship of Lord Object cannot be counted against it.
> I agree with author Christiansen here.
Sometimes it's hard to have a choice in today's languages, and even society.
It used to be that when I walk on the street there's any chance that'll be
swiped by beasts, or that I can just lop someone's head off for fun (it's up
to my capabilities whether I can carry it out successfully). But today I
don't have such choices anymore. I'm stuck with this civilization thingy and
every thing is a damn system with schooling literally injected into my
brain.
> You've got them if you want them. You don't have them if you don't
> want them. We call it "free will". *THIS* is a a feature.
Well said.
Was it H. G. Wells who said "Human history becomes more and more a race
between education and catastrophe"? Yeah right! (yes, I'm being sarcastic
here.)
Xah
xah@best.com
http://www.best.com/~xah/PageTwo_dir/more.html
"unix, the world's most impressive shit pile"
- autononymous
> --tom
> --
> "Unix is the answer, but only if you phrase the question very carefully."
> - Belinda Asbell
------------------------------
Date: 22 Aug 1999 02:22:28 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <slrn7rv9bc.c9p.abigail@alexandra.delanet.com>
Alan Curry (pacman@defiant.cqc.com) wrote on MMCLXXVI September MCMXCIII
in <URL:news:OwXt3.4340$x04.225884@typ11.nn.bcandid.com>:
--
-- On the more general question of overloading +, it stinks. "+" is a math
-- symbol. It shouldn't be used for operations that don't somehow correspond to
-- the mathematical concept of addition.
--
-- If a sane language were ever to allow + on strings, it should work like this:
--
-- "one" + "one" == "two"
-- "One" + "One" == "Two"
-- "1" + "1" == "2" # perl already does this one correctly!
-- "apples" + "oranges" generates a fatal exception, of course.
So... this is why Perl does identical things with | and &, regardless
whether the operands of | and & are strings and numbers, right? And
/foo/ .. /bar/ in scalar context first evaluates /foo/ and /bar/ into
numbers, then does the same as <num> .. <num> does, right?
Or perhaps, Perl *does* have operator overloading based on the type
of the arguments?
After I mention context and "use overload" (context!, "use overload"!),
I'd say "if you don't like operator overloading, don't use Perl".
(Oh, and the horrors of the "pseudo-operator" bool, that produces different
results based on the type of the expression)
What of course really sucks in Perl is that you cannot easily do operator
overloading, unless you resort to 'use overload'. Which of course, doesn't
have overload magic for assignment or indexing. For that, Perl has ties.
Afterall, it *has* to be difficult to create a type for which both assignment
and addition are overloaded. (What did you say again, "Perl makes difficult
things easy and hard things possible"? Yeah, but should it make easy things
hard?)
Oh, and don't even think of creating an overloaded operator with lazy
evaluation/short circuiting. Or to overload an operator such that it
takes a regex as argument.
Abigail
--
perl -wlne '}print$.;{' file # Count the number of lines.
-----------== 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: 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 613
*************************************