Why use Perl when we've got Python?!

Alex Maranda amaranda at nospam.com
Sat Aug 14 07:06:11 EDT 1999

Sam Holden wrote: 
> >
> >>You can write Perl programs that resemble sed, or awk, or C, or Lisp, or
> >>Python. This is Officially Okay in Perl culture.
> >
> >You cannot write Perl that resemble Python.  You are required to
> >use curly braces as block delimiters.
> In fact you are not. You are wrong yet again. Actually thinking about how
> perl works for a minute would show you that perl is in fact flexible.
> it is not a lie when people say perl doesn't force you to write a
> particular way.
> 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
> {
>   return 1 if ($active++);
>   open CODE, $0 or die "couldn't translate $0";
>   my ($code, $transcode, $lastindent) = (join('',<CODE>), '');
>   $code =~ s/\\\n/ /g;
>   foreach (split /\n/, $code)
>   {
>   my ($indent,$notempty) = /\A([ \t]*)(\S?)/;
>   $indent = length(expand($indent));
>   $transcode .= $bracket[1+($lastindent<=>$indent)]
>     if $notempty && defined $lastindent;
>   $transcode .= "$_\n";
>   $lastindent = $indent if $notempty;
>   }
>   eval $transcode and exit or die $@;
> }
> 1;
> And here is his sample code that is now valid perl (although anyone who uses
> it for real code should be killed) :
Why? You don't happen to hate Pythoneers or Python itself, do you? I've
actually appreciated the argument from your second post, when you taxed
the other guy for needlessly questioning your Python knowledge out of
I am completely ignorant with Perl and I can barely read what's above
(by interpolating my knowledge of shell, C, and Tcl).

> #Now newlines replace colons and indentation replaces brackets:
> for $i (1..10)  # COMMENTS ARE OKAY
>   print "$i: "
>   my $isq =  \
>   print " $isq\n"
> print "done\n"
I know Python fairly well (but I'm no expert) and I can easily read this
piece of Perl. Getting back to the killing part, which kind of disturbs
me when reading comp.lang.python:
- was that necessary to make a point?
- if yes, what was the point?
- if the point (just guessing) was that Perl code should never look like
Python, isn't that against of 'there should be more ways of doing it?'

I fail to see the interesting part in this whole thread, which disturbs
the habitat of comp.lang.python. I think John Stevens was mistaken to
bring the discussion over to this newsgroup in the first place. We don't
have strong feelings about Perl, and don't have plans for world
domination or anything.

A couple of days ago I read a bit in Bugzilla's README which amused me:
"A computer which doesn't have Perl installed is a very sad computer
indeed". Your post is frightening (unless it was a Perl-style joke).

Regards (I guess),

More information about the Python-list mailing list