-- "G. Wade Johnson" <[EMAIL PROTECTED]>

On Tue, 7 Jan 2003 20:39:29 -0800
Jeremy Zawodny <[EMAIL PROTECTED]> wrote:

On Tue, Jan 07, 2003 at 07:46:33PM -0600, G. Wade Johnson wrote:

> But it occurs to me that a large portion of what you need to write
> good Perl is a firm understanding of Perl's idioms.

Really?

Can you elaborate on that?  It sounds like you're just saying that
"good perl looks like ..." but I suspect there's more to it than that.
It is possible for people from shell, C, awk/sed, or
LISP backgrounds to write Perl code that basically
resembles any of those languages. Their programs
will work but will not be very elegant and will be
bulky because they will not use features of Perl
that are not available in other languages. This is
not idiomatic Perl, it's "Perl that looks like X".

One example is a gent I worked with who said he
hated Perl becuase it couldn't handle string
operations,  especially matching. When I asked
what he meant by that, the eample he gave me was
"match this string in the middle of that one and
change it to this other string". I wrote something
like "$foo = s/this/that/". To which he exclaimed
"that isn't Perl it's sed. I want to know how
Perl does it by itself!"

He wrote Perl that looked like awk and piped it
into programs that looked like sed that got piped
into programs that looked like shell. I re-write
the code in a single Perl program and it took
about one tenth of the lines and even had comments.
He was upset about my mixing Perl that looked like
all those different languages into a single
program becuase he could no longer tell which
language it looked like.

He did not write idiomatic Perl.




--
Steven Lembark                               2930 W. Palmer
Workhorse Computing                       Chicago, IL 60647
                                           +1 773 252 1080

Reply via email to