Is Perl *that* good?

Asun Friere afriere at yahoo.co.uk
Tue Apr 27 03:08:19 EDT 2004


Kirk Strauser <kirk at strauser.com> wrote in message news:<87fzaqmm8t.fsf at strauser.com>...

> I haven't noticed much of a different between Perl's regex and Python's
> re.py module, other than I'm now typing:
> 
>     pattern.match(string)
> 
> instead of
> 
>     string ~= pattern

How does pattern (in the python example) come to have a 'match'
method?

Wouldn't you need to import the re module and compile the pattern
first?  (And wouldn't you use 'search' rather than 'match'?)  And
other steps, depending on what you want to do with the resulting match
object.

Regex is much more 'immediate' in Perl.  Probably the only time I
would reach for Perl rather than for python is when I knew a task
involved a lot of regex (and no object orientation).



More information about the Python-list mailing list