[13129] in Perl-Users-Digest
Perl-Users Digest, Issue: 539 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Aug 15 07:09:06 1999
Date: Sun, 15 Aug 1999 04:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sun, 15 Aug 1999 Volume: 9 Number: 539
Today's topics:
Appending a "\n" to all array elements / unchomp marcza@my-deja.com
Re: Appending a "\n" to all array elements / unchomp (Malcolm Ray)
Re: array and file processing (Michel Dalle)
Array/list/split/push handling question marcza@my-deja.com
Re: HARASSMENT -- Monthly Autoemail <flavell@mail.cern.ch>
Re: HTTP redirect..not working <flavell@mail.cern.ch>
MD5 Replay Cache (Robert A. Costner)
perldoc -> HTML site on the web? <test@test.com>
Re: perldoc -> HTML site on the web? <meowing@banet.net>
right (Gabriele Gallacci)
Re: right (Malcolm Ray)
Re: Splitting up huge codes.. <swiftkid@bigfoot.com>
Re: Udate file using another file (Michel Dalle)
Re: Why use Perl when we've got Python?! (Abigail)
Re: Why use Perl when we've got Python?! (Abigail)
Re: Why use Perl when we've got Python?! (Abigail)
Re: Why use Perl when we've got Python?! (Abigail)
Re: Why use Perl when we've got Python?! (Martijn Faassen)
Re: Why use Perl when we've got Python?! (Martijn Faassen)
Re: Why use Perl when we've got Python?! (Abigail)
Re: Why use Perl when we've got Python?! (Abigail)
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 15 Aug 1999 10:09:37 GMT
From: marcza@my-deja.com
Subject: Appending a "\n" to all array elements / unchomp
Message-Id: <7p63l0$3kh$1@nnrp1.deja.com>
Well, I can remove all trailing "\n" from a list/array by using
chomp. But how is the easiest (!) way of doing the opposite:
appending "\n" to all elements ?
Is there something like an unchomp() ?
bye
Marcus
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 15 Aug 1999 10:29:02 GMT
From: M.Ray@ulcc.ac.uk (Malcolm Ray)
Subject: Re: Appending a "\n" to all array elements / unchomp
Message-Id: <slrn7rd5je.kg2.M.Ray@carlova.ulcc.ac.uk>
On Sun, 15 Aug 1999 10:09:37 GMT, marcza@my-deja.com <marcza@my-deja.com>
wrote:
>Well, I can remove all trailing "\n" from a list/array by using
>chomp. But how is the easiest (!) way of doing the opposite:
>appending "\n" to all elements ?
>
>Is there something like an unchomp() ?
#!/usr/bin/perl -w
use strict;
my @a = qw(an array of words);
for (@a) { $_ .= "\n" }
__END__
--
Malcolm Ray University of London Computer Centre
------------------------------
Date: Sun, 15 Aug 1999 10:32:35 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: array and file processing
Message-Id: <7p64ua$huq$1@xenon.inbe.net>
In article <7p4umj$chp$1@nnrp1.deja.com>, Teacher Guy <habfan2@my-deja.com> wrote:
>In article <7p159j$h1j$1@news.mch.sbs.de>,
> michel.dalle@usa.net (Michel Dalle) wrote:
[snip]
>> #!/usr/local/bin/perl -w
>> use strict;
>> my(%hash,%topscore);
>
>I have a couple of syntax questions:
>Why do you use "my"?
To declare the variables 'hash' and 'topscore'. You need to do that
if you use strict (which is a good thing).
>
>> while (<DATA>) {
>> chomp;
>> my ($student,$score,$tottest,$course) = split(/\|/);
>> # calculate percentage (and show with 1 digit precision)
>> my $percent = sprintf("%.1f",$score/$tottest*100);
>> $hash{$student}{$course} = $percent;
>> }
>
>What are you assigning $percent to actually?
>What is difference between $hash{$student} and $hash{$stud}?
>Why do you choose $student and $course when you assign $percent to
>$hash?
I see you haven't read perllol and perldsc yet. Do so now...
Hint : 'hash' is a hash-of-hashes in this case, with 'student'
(or 'stud' for short :-)) as the first-level key, and 'course' as the
second-level key. So, student $student followed course $course,
and got a score of $percent.
If you are more interested in courses than in students, you could
for example use $hash{$course}{$student}.
>> $maxidx = $maxidx > 10 ? 9 : $maxidx - 1;
>
>What is "10 ? 9" ............
The construct X = A ? B : C is kind of a short-hand for
if (A) {
X = B;
}
else {
X = C;
}
>Q on keys:
>
>keys %$hash{stud}{$course} <--- a hash of hashes??
Well, it is a hash of hashes, so keys %hash will return
all the students, and keys %{$hash{$stud}} will return
all the courses followed by student $stud.
But $hash{$stud}{$course} only contains one value, i.e.
the percentage, so what you're writing is not right - it
would be a hash of hashes of hashes....
>Again, thank you for your insight.
Well, I sure hope your 'Teacher Guy' will be happy now :-)
(Then again, since there's more than one way to do it, this
may not be the way he prefers...)
Michel.
------------------------------
Date: Sun, 15 Aug 1999 10:20:52 GMT
From: marcza@my-deja.com
Subject: Array/list/split/push handling question
Message-Id: <7p64a3$40l$1@nnrp1.deja.com>
Suppose the follwoing string
$text = "aaa bbb ccc ddd eee fff";
Now I want to skip the first 3 words (delimited by space)
and assign the rest to a new array AND insert a new element at the
first position:
I could do that with:
(undef, undef, undef, @arr) = split(/ +/,$text);
push(@arr, "newelem");
I feel that this could be done shorter but how ?
Any ideas ?
Thanx
Marcus
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Sun, 15 Aug 1999 11:46:40 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: HARASSMENT -- Monthly Autoemail
Message-Id: <Pine.HPP.3.95a.990815114342.27038D-100000@hpplus03.cern.ch>
On Sat, 14 Aug 1999, Bill Moseley wrote:
> I don't feel like it's a huge waste of my time reading articles that
> aren't quoted properly.
Seems you have time on your hands.
> But, I do find it a waste of my time trying
> weed out the interesting perl related articles from all the threads like
> this one.
Then stop posting them.
> I feel sorry for people that come here for real perl help only to have
> their questions lost in the noise.
So do I. So help us to cut down the noise, by setting a good example,
giving a good and wellformed answer to the questions you're competent to
answer, and using your killfile on anything you'd rather not see.
------------------------------
Date: Sun, 15 Aug 1999 11:58:29 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: HTTP redirect..not working
Message-Id: <Pine.HPP.3.95a.990815114837.27038E-100000@hpplus03.cern.ch>
On Sun, 15 Aug 1999, Sunfox wrote:
> Print this out instead:
>
> print "Content-type: text/html\n";
What's that for? A Location CGI response doesn't need a content-type.
> print "Location: http://www.foo.com/index.html\n\n";
>
> Works for me.
Lots of bizarre things can be made to look as if they're working.
Doesn't necessarily mean they're right.
When someone makes a mistake, as this posting did:
> >print "HTTP/1.0 302 Found\n";
I'd say the important thing is to point out the mistake and explain why
it's a mistake, rather than giving them some unrelated variation that
appears to work but has nothing to do with the actual error.
Mind you, asking in the wrong place always increasing the chance of that
happening. As I said before, comp.infosystems.www.authoring.cgi
(actually there's no reason to ask this question - any simple CGI
tutorial should get this right, and there's Nick Kew's CGI FAQ to
consult).
Oh look, you hung the entire previous content on the end of your f'up.
We know what that means. Perhaps we should stop trying to persuade
people not to do it, it may be too valuable as a bogosity indicator.
:-{
[f'ups set]
------------------------------
Date: Sun, 15 Aug 1999 11:04:19 GMT
From: rcostner@serversystems.net (Robert A. Costner)
Subject: MD5 Replay Cache
Message-Id: <37b699e2.183196667@news2.serversystems.net>
In Perl I am creating a "replay cache" text file 1,000 lines long,
each line being a 33 byte hex code known as an MD5 checksum. (MD5 is a
CPAN library) The program then takes a series of text messages and
processes them. For each message a new MD5 checksum is created and
appended to the end of the list, while the oldest checksum is removed
from the list.
The way I do this is rewrite the entire list, line by line, each time.
I'm using the grep command to look for matches. I use a text file
only for convienence. The 1,000 entries is just a number I pulled out
of the air; it could be larger. This seems inefficent. Can someone
suggest a better way to store and remove entries from my replay cache?
(An email CC to me would be appreciated)
------------------------------
Date: Sun, 15 Aug 1999 10:09:30 GMT
From: "test" <test@test.com>
Subject: perldoc -> HTML site on the web?
Message-Id: <01bee706$45305cd0$5a1dd2cc@sd>
Call me lazy, but I was wondering if there was a perldoc -> HTML website
out there on the Internet somewhere. I've seen some people out there who
run public man2html pages, such as the one run by FreeBSD.org people.
(http://www.freebsd.org/cgi-bin/man.cgi)
But I've yet to come across a perldoc2html page.
Is there one? If not, is there a perl script to run something like this on
my own web server?
------------------------------
Date: 15 Aug 1999 07:00:57 -0400
From: meow <meowing@banet.net>
Subject: Re: perldoc -> HTML site on the web?
Message-Id: <874si1mhp2.fsf@slip166-72-251-196.ma.us.ibm.net>
test <test@test.com> wrote:
> Call me lazy, but I was wondering if there was a perldoc -> HTML website
> out there on the Internet somewhere. I've seen some people out there who
> run public man2html pages, such as the one run by FreeBSD.org people.
> (http://www.freebsd.org/cgi-bin/man.cgi)
> But I've yet to come across a perldoc2html page.
<URL:http://www.perl.com/pub/v/documentation>
> Is there one? If not, is there a perl script to run something like this on
> my own web server?
Sure, it comes with the language. perldoc pod2html for details.
------------------------------
Date: 15 Aug 1999 09:52:40 GMT
From: info@gallacci.com (Gabriele Gallacci)
Subject: right
Message-Id: <8E2379A84mailbygallaccicom@news.tin.it>
thx, I think $ENV is sufficient for me, since I'm on a LAN
--
Dott Gabriele Gallacci
email: info@gallacci.com
------------------------------
Date: 15 Aug 1999 10:23:53 GMT
From: M.Ray@ulcc.ac.uk (Malcolm Ray)
Subject: Re: right
Message-Id: <slrn7rd59p.kg2.M.Ray@carlova.ulcc.ac.uk>
On 15 Aug 1999 09:52:40 GMT, Gabriele Gallacci <info@gallacci.com> wrote:
>thx, I think $ENV is sufficient for me, since I'm on a LAN
Maybe something's wrong with your newsreader: your article didn't contain
a References: header, so it's not a followup to anything. It'll mystify
a lot of readers...
--
Malcolm Ray University of London Computer Centre
------------------------------
Date: Sun, 15 Aug 1999 15:03:07 +0500
From: "Faisal Nasim" <swiftkid@bigfoot.com>
Subject: Re: Splitting up huge codes..
Message-Id: <7p76kr$25t1@news.cyber.net.pk>
: Hello people,
: I came across sorta huge perl code, and I am thinking of splitting it
: up into pieces, so I could easier maintain it, and here's what I am
: wondering about:
:
:
: the common way of performing such things is to have
: require 'foobar.pl', right? or if I could put whole set of subbs into
: package, I could save it as .pm, and have uses foobar.pm instead.
: But I am curious if there're another quirks which would help me to
: achieve the similar task? (one, I could think of, is :
: open(FOO,"foobaz.pl") || die "yuk!";
: eval $_ while(<FOO>);
: close FOO;
see require()
------------------------------
Date: Sun, 15 Aug 1999 11:00:20 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: Udate file using another file
Message-Id: <7p66ia$huq$2@xenon.inbe.net>
In article <7p4f75$d4t$1@nnrp01.ops.uunet.co.za>, "Romiko" <rvdd@iafrica.com> wrote:
>I have been trying to write a script that compares two similar files and
>updates the changes , I have been trying for two days and cannot get it
>right. FileA is the Table that needs to be updated and fileB is the table
>with the latest records. The third field in FILEA(cifa) needs to be
>compared
>with the first field in FILEB(cifb) and the fith field in FileA(Account
>number) compared with the 3rd field in FileB (Account Number)to see whether
>an existing customer open another account eg had a savings and then opened a
>cheque account later.
[snip]
Your explanation is not 100% clear, but why don't you show us what you
have tried, and tell us where it did go wrong ?
Michel.
------------------------------
Date: 15 Aug 1999 05:23:20 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <slrn7rd5al.a5.abigail@alexandra.delanet.com>
John Stevens (jstevens@bamboo.verinet.com) wrote on MMCLXXIV September
MCMXCIII in <URL:news:slrn7rb1nc.cf9.jstevens@bamboo.verinet.com>:
$$ On 14 Aug 1999 04:08:05 GMT, Sam Holden <sholden@pgrad.cs.usyd.edu.au> wrote:
$$ >That could simply have been a reference. Or a symbolic reference.
$$ >
$$ >What is fundamental is that a @ tacked on the front indicates that it is an
$$ >array.
$$
$$ What is so amusing about that, is that you can say that with a straight
$$ face!
It's nice to see you have fun about nothing.
$$ >So given @$fred, even with no knowledge of what that exactly means
$$ >you should be able to tell that it is somehow treating $fred as an array.
$$
$$ No, what any reasonable person would do would be to grab for his
$$ Perl book. . .
Perhaps the first and the second time he encounters it. If he needs it
a third time, he sucks as a programmer. How often have you looked this
up? Just what I said.
$$ >>Yes. . . is it a hash, or a scalar? If it is a scalar, why
$$ >>is it called dict? If it is a hash, then why is it prefixed
$$ >>by $? If this is a reference instead of a scalar, then why
$$ >>doesn't it have it's own special prefix character. ;->
$$ >
$$ >It's a scalar. It is named dict because TomC called it that.
$$
$$ Yes. My point exactly.
$$
$$ >It is
$$ >also named that since it is a reference to a hash. I use code like this
$$ >in C quite a bit :
$$
$$ A reference to a hash. . . and yet TC claims that Perl is open to
$$ non-computer scientists.
Yep. Only computer scientists use pronouns. It's too difficult for the
rest of the people. Pronouns were invented by Turing, in the early 50s.
$$ Doesn't *ANYBODY* else see the irony in that?
No. What's the reference phobia? Does it give you spots?
$$ >If you know what it means then why do you continually get it wrong
$$ >throughout this thread?
$$
$$ I don't suppose that you realize that getting wrong simply
$$ proves (and illustrates) my point?
$$
$$ I learned it. I used it. I haven't written a new Perl program
$$ in three months.
$$
$$ I come back to it, I get it wrong. . . do you see, yet,
Yes, we see. You suck as a programmer.
$$ >Here is some code from Damian Conway from the 'Impythonating PERL' thread
$$ >in march.
$$ >
$$ >package impythonate;
$$ >use Text::Tabs;
$$ >my ($active, @bracket) = (0, ('{', ';', '}') );
$$ >sub import
$$ >{
$$ ^ Look closely. . . see that curly brace?
$$
$$ >And here is his sample code that is now valid perl (although anyone who uses
$$ >it for real code should be killed) :
$$
$$ To late. You already used a curly brace. Disproving your point,
$$ in case you hadn't realized it.
It looks like you have a problem following a linear argument.
Abigail
--
sub f{sprintf$_[0],$_[1],$_[2]}print f('%c%s',74,f('%c%s',117,f('%c%s',115,f(
'%c%s',116,f('%c%s',32,f('%c%s',97,f('%c%s',0x6e,f('%c%s',111,f('%c%s',116,f(
'%c%s',104,f('%c%s',0x65,f('%c%s',114,f('%c%s',32,f('%c%s',80,f('%c%s',101,f(
'%c%s',114,f('%c%s',0x6c,f('%c%s',32,f('%c%s',0x48,f('%c%s',97,f('%c%s',99,f(
'%c%s',107,f('%c%s',101,f('%c%s',114,f('%c%s',10,)))))))))))))))))))))))))
-----------== 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: 15 Aug 1999 05:25:34 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <slrn7rd5et.a5.abigail@alexandra.delanet.com>
John Stevens (jstevens@bamboo.verinet.com) wrote on MMCLXXIV September
MCMXCIII in <URL:news:37b4cf10@cs.colorado.edu>:
__ In comp.lang.perl.misc, you wrote:
Who is "you"?
__
__ >A CGI monstrosity from a
__ >script kiddie isn't, but this is irrelevant.
__
__ Actually, they are *VERY* relevant! Those CGI monstrosities are
__ Perl, they go into the statistics, and somebody somewhere has to
__ maintain them, and somebody has to pay to get them maintained.
So, the best language would be one noone uses? So, it can't be misused
and held against you?
Brilliant idea. Very useful as well.
Abigail
--
split // => '"';
${"@_"} = "/"; split // => eval join "+" => 1 .. 7;
*{"@_"} = sub {foreach (sort keys %_) {print "$_ $_{$_} "}};
%{"@_"} = %_ = (Just => another => Perl => Hacker); &{%{%_}};
-----------== 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: 15 Aug 1999 05:40:40 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <slrn7rd6b7.a5.abigail@alexandra.delanet.com>
John Stevens (jstevens@bamboo.verinet.com) wrote on MMCLXXIV September
MCMXCIII in <URL:news:slrn7rb2s2.cf9.jstevens@bamboo.verinet.com>:
%% On 14 Aug 1999 02:55:19 GMT, Eric Bohlman <ebohlman@netcom.com> wrote:
%% >John W. Stevens (jstevens@basho.fc.hp.com) wrote:
%% >[quoting someone whose name was lost]
%% >: > It is wrong from the Larry's principle that things that behave
%% >: > differently should have different appearances.
%% >:
%% >: Then why doesn't Perl have two different operations for
%% >: assign/reassign, vs. add to an array? A tiny little violation of
%% >: Larry's principles, that.
%% >
%% >Nope. "Behave differently" hear means "accomplish two different tasks."
%% >Comparing two strings to see if they're equal lexically is not the same
%% >task as comparing two strings to see if they're equal numerically.
%%
%% Right. Do you see what I am saying? Automatic coercion (from string to int)
%% created a problem. The problem was dealt with by making a change that
%% impacts the language.
What's next, different types for prime numbers and non-prime numbers?
%% As well as providing a huge opportunity for defects, the complexity
%% of the language was increased.
Look. All we've seen from you here is a 4 line Python program,
riddled with bugs. And your Perl knowledge is at the same level as my
hair dressers. All that proves is that you are in desparate need of
something that protects you from making mistakes, and that Python isn't
giving you that.
%% >Putting a particular value in a particular position in an array that
%% >already holds a value *is* the same task as putting a particular value in
%% >a particular position of an array that does not yet hold a value; the
%% >only difference is in the internal details of how to accomplish it.
%%
%% Yes, but the context of this was TC's comparison with Python's lists.
%%
%% For an ARRAY, your argument makes sense. For a list, it does not,
%% yet TC was taking Python lists to task for not acting like arrays.
%%
%% On the other hand, Perl's behavior encourages defects:
%%
%% $array[$index] = $newWord;
%%
%% The program ran for a very long time, then the system started thrashing,
%% then it core dumped.
%%
%% The value of $index? Very, very large. Perl happily tried to allocate
%% Gigabytes worth of core.
Well, then don't do that then. Djees. Consider a Python equivalent:
while len (array) <= index + 1: # Why isn't that array.len() ???
array.append (0)
array [index] = newWord;
Would that somehow magically have prevented index not to be large?
%% For example (another real bug, here):
%%
%% $result = $Total / $count;
%%
%% Generated a division error. $count contained the string: "Payroll". . .
And in Python it would produce some result?
Abigail
--
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(
HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (
LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET",
"http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content))
=~ /(.*\))[-\s]+Addition/s) [0]'
-----------== 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: 15 Aug 1999 05:44:37 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <slrn7rd6ik.a5.abigail@alexandra.delanet.com>
John W. Stevens (jstevens@basho.fc.hp.com) wrote on MMCLXXIV September
MCMXCIII in <URL:news:37b4cf70@cs.colorado.edu>:
''
'' But if you do like OO, don't Perl.
I actually agree with that. But then, for the same reason, I wouldn't
use Python either. You see, Perl's OO model was taken from Python.
I don't like Perl's OO model, because 1) it doesn't give me what I want
from an OO model and 2) it doesn't give me what the rest of Perl does.
It's very unlikely I would turn to Python for its OO.
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: 15 Aug 1999 10:53:51 GMT
From: m.faassen@vet.uu.nl (Martijn Faassen)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <7p667v$o6o$1@newshost.accu.uu.nl>
Alan Barclay <gorilla@elaine.drink.com> wrote:
> In article <7p2ckj$bb4$3@newshost.accu.uu.nl>,
> Martijn Faassen <m.faassen@vet.uu.nl> wrote:
>>Using both { and } and whitespace to mark block structure is redundant.
> Redundancy is good in computer langauges. It allows cross checking of
> the intended usage.
> If I have some code which goes
> if(){
> if(){
> }
> some code
> }
> Then even without any knowledge of the language,
I would debate that. If you come from C-style languages, sure.
> the problem or anything
> else, I know there is something wrong. The indentation does not match
> up with the brackets.
But it might not be wrong after all, right? I don't really get this
argument; there's no redundancy in the language here, as Perl doesn't
care a whit about whitespace. Your editor might, and you might, but it's
not part of the language. One can equally introduce such redundancy to
Python if one so desires, by using #{ and #} or whatever you like.
> If I rewrite this as:
> if()
> if()
> some code
> Then there is now nothing to indicate that something is wrong.
I find this odd. How did the previous code become miraculously unindented
in the first place? Why did this happen in Python, where indentation is
the key to block structure?
Besides, this code isn't legal Python, and Python would complain at this:
if foo:
if bar:
some code
As 'bar' has no block. If you want an empty block for some reason, you use
'pass' in it, and so you'd write this:
if foo:
if bar:
pass
some code
> I personally gave up on python after wasting several hours trying to
> find a bug caused by incorrect indentation.
Okay; it just never seems to happen to me. I will accept experiences
differ in this. I still don't think the whitespace argument against
Python is a good one. Far better arguments exist; use those. :)
Regards,
Martijn
------------------------------
Date: 15 Aug 1999 10:55:18 GMT
From: m.faassen@vet.uu.nl (Martijn Faassen)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <7p66am$o6o$2@newshost.accu.uu.nl>
Tom Christiansen <tchrist@mox.perl.com> wrote:
> [courtesy cc of this posting mailed to cited author]
> In comp.lang.perl.misc,
> gorilla@elaine.drink.com (Alan Barclay) writes:
> :I personally gave up on python after wasting several hours trying to
> :find a bug caused by incorrect indentation.
> That's certainly a telling statement.
I'm not a native speaker of English and I don't seem to be told; how is
it a telling statement?
Regards,
Martijn
------------------------------
Date: 15 Aug 1999 05:57:57 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <slrn7rd7bk.a5.abigail@alexandra.delanet.com>
meow (meowing@banet.net) wrote on MMCLXXIV September MCMXCIII in
<URL:news: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.
If you have a large program, with a couple of hundreds of lines,
a few import statements at the beginning don't matter that much.
For onelines, it does though. ;-)
You have a point that modularity makes it easier to change a languages
behaviour. But do you really want that? Do you want to change, or remove
existing behaviour, causing old scripts to no longer work, or to work
differently if you upgrade your language? If you just add functionality,
it hardly matters (except perhaps for the poor sobs implementing it).
Of course, both you and Russ are absolutely right that one shouldn't
judge the difficulty of a language on how large the core is, but what
you need to learn to actually get your work done.
Abigail
--
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 15 Aug 1999 06:01:45 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <slrn7rd7in.a5.abigail@alexandra.delanet.com>
John Stevens (jstevens@bamboo.verinet.com) wrote on MMCLXXIV September
MCMXCIII in <URL:news:slrn7r9jr4.an4.jstevens@bamboo.verinet.com>:
<> On 13 Aug 1999 17:07:10 -0700, Tom Christiansen <tchrist@mox.perl.com> wrote:
<> > [courtesy cc of this posting mailed to cited author]
<>
<> When a perl user insists on using Perl, I simply teach him to do
<> OO in Perl. Usually (not always, we aren't talking about absolutes,
<> here) they eventually switch to Python.
Which has the same bad OO model as Perl. What's their gain?
<> >Perl remains proudly pedestrian in its roots.
<>
<> What does that mean?
KISS.
Abigail
--
sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==>"$A$Y".
"$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=*_;sub _{print+/.*::(.*)/s}
*_'_=*{chr($b*$e)};*__=*{chr(1<<$e)};
_::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t(us(J())))))))))))))))))))))))
-----------== 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 539
*************************************