[Tutor] Are you allowed to shoot camels? [kinda OT]

Nicholas.Montpetit at deluxe.com Nicholas.Montpetit at deluxe.com
Thu Feb 3 14:43:01 CET 2005

Well, here's my $0.02. 

I would recommend caution regarding the trashing of Perl.  One thing I've 
been very impressed with on this list (and other segments of the Python 
community) is the _fairly_ cordial relationship between the supporters of 
the two languages.  Contrast that to a lot of PHP literature I've seen, 
which doesn't even acknowledge that Perl exists.  My theory is that many 
who use PHP got kicked around by trying to learn Perl, and bitterness set 
in.  But that's a digression...  Anyway, I'm on the fence as to whether I 
want to learn Python (not exactly a "core competency" for statisticians, 
but I do line the numerical computation capabilities which look _much_ 
better than those of Perl), and I wouldn't want this negativity to push me 
(or others) away.

I'll try to speak to a few of the points below, from my limited 

> Had the *ahem* joy of learning Perl last night. Egad. Wrote the script
> in Python to get it right, and then 'translated' it to Perl. Does the
> style of coding Python engenders suit the Perl environment in anyone's
> experienc? AFAI can see there is no real 'style' to Perl, apart from
> white noise of non alphanumeric characters.

Actually, because there is "more than one way to do it", you can impose 
any style you want on your code, and (in my opinion) the onus _should_ be 
on the user to use "proper" style, however you want to define that.  As 
Larry Wall says in the excellent "Natural Language Principals in Perl", 
"It's officially okay in the Perl realm to program in the subset of Perl 
corresponding to sed, or awk, or C, or shell, or BASIC, or Lisp or 
> 1) I'll use Perl for the regex stuff from now on, Perl is obviously
> built for this.

No tool is better than Perl for that, IMO.
> 2 ) There's More Than One Way To Do It makes debugging hard - i.e. 
> close INFILE; & close (INFILE); are both valid. I like one syntax, cos
> it's easier to remember.

Many people see "there's more than one way to do it" as a good thing.
> 3) Some stuff is counter-intuitive - 
> $lenOfModList = @moddirList is the Perl equivalent of lenofModList =
> len(moddirList)
> @someArray = (@someArray, $newValue) is the same as 

It's only counter-intuitive if you don't know the language.  Once you know 
the language, it's very intuitive.  One could say that the theory of 
relativity is counter-intuitive, but to a physicist (or even anyone else 
who's thought about it for a while) it _is_ intuitive.  It's all about 
context and perspective.  Speaking of context, once you understand the 
concept of "context" in Perl, the statements above are very intuitive -- 
and elegant -- in my opinion.

> Also, why doesn't if ( not $d eq "a" && not $d eq "c") evaluate to
> true for $d = "b" when
> if (not $d eq "a") evals to true and if ($d ne "a" && $d ne "c") evals
> true also? What's with that?

Must be an order-of-operations or logic thing, and I can assure you -- 
without even looking at it much -- that the problem isn't Perl's.
> I'm not referring to the $ & @, I can see how they could be useful,
> although with a list -
> @dude = (1, 2, 3), to obtain the 2nd value I would expect $d = @dude[1], 

> not $d  = $dude[1], that's counterintuitive also. 

The definition of "counterintuitive" is based on context.  That stuff is 
very intuitive when you understand the language.
> Oh, no, what I'm referring to is stuff like @_, and @!, and @indexFile
> = <INFILE> to read a whole file, and this - I hate Perl for this -
> open OUTFILE, ">c:/python23/j/index.htm"
> What's the difference between
> open OUTFILE, "c:/python23/j/index.htm"   and
> open OUTFILE, ">c:/python23/j/index.htm" ?
> The first will open index.htm with the handle OUTFILE, to read... 
> The second will open index.htm with the handle OUTFILE to write!.

So?  That's the syntax of the language. I don't know why that would be 
> Of course, the documentation I had didn't mention that. It just said
> to open it and use
> print FILEHANDLE $value; to write. Oh no, I had to find a CGI Perl
> tutorial, which mentioned using &lst; to open and &gst; to write (or
> something), which I guessed as lesser/greater than.
> Why is the read/write modifier part of the filename??? Why is it a > ?
> In my opinion, there's only one place a > sign should be, in an
> inequality test.

Nicholas Montpetit
Deluxe Business Services
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20050203/b4e44d35/attachment.htm

More information about the Tutor mailing list