Perl Whitespace Reg Expression

Bill Campbell linux-sxs
Fri Nov 18 15:26:45 PST 2005


On Fri, Nov 18, 2005, Matthew Carpenter wrote:
>On Sunday 09 October 2005 15:15, Bill Campbell wrote:
>> >Just a minor nitpick. I use
>> >
>> >   my @line = split('\s+', $_);
>
>Since we're nit-picking (sorry for the long overdue post), I prefer the 
>following since it is cmdline-friendly:
>
>split(/\s/, $stuff);
>>
>> Right!  My perl's getting rusty as I've been doing most of my
>> development in python for the last year or so (with lots of
>> commented curly braces to make vi's % key happy :-).
>
>What do you think of python?  I've spoken to some real supporters.  I've only 
>in recent years picked up perl, and python is indent-blocked.  That is scary.
>Ruby is another interesting option.  But I'm committed to learning Python a 
>bit.  I've bought the O'Reilly Pocket guide and printed off some tutorials.  
>Seems easy enough, now I just gotta use it a bit.

I like python enough that I'm doing most of my development in it now.  It
takes me a while to get back in perl mode when I have to work on existing
programs (I keep leaving ``;'' off the end of lines, and tend to write
pythonish ``for var in'' a lot :-).  It's gotten to the point that I'm
writing quicky system admin scripts in python rather than perl.

I've been programming perl since perl-3.something, and my initial reaction
to python's indendation was somewhat similar to Eric Raymond's ``steaming
pile of dinosaur dung''.  I first started using python after deciding to
move most of our web stuff over to Zope and Plone which are written mostly
in python so it's the natural language to use with that.  As I said in my
previous post, I do use a lot of comments with #{ and #} to mark blocks so
that I can take advantage of vi(m)'s ``%'' matching for easy navigation
while programming (they may be ugly to the python faithful, but they're
better than learning emacs).

I find python's classes and object oriented implementation easier to use
(and type) than perl's.  While perl gurus, such as Damien Conway, may be
able to take advantage of much of perl's magic, even after programming perl
for almost 20 years, I prefer's simple, non-magical approach easier to use,
and, more important, figure out what I did when looking at old scripts --
old being anything I haven't looked at in a month or so.

Bill
--
INTERNET:   bill at Celestial.COM  Bill Campbell; Celestial Systems, Inc.
UUCP:               camco!bill  PO Box 820; 6641 E. Mercer Way
FAX:            (206) 232-9186  Mercer Island, WA 98040-0820; (206) 236-1676
URL: http://www.celestial.com/

``The fact is that the Constitution was intended to protect us from
the government, and we cannot expect the government to enforce it
willingly'' -- Dave E. Hoffmann, Reason Magazine March 2002


More information about the Linux-users mailing list