>>>>> "TB" == Tim Bowden <tim.bow...@mapforge.com.au> writes:

  TB> On Thu, 2009-09-03 at 11:39 +1000, Dave Tang wrote:

  >> I wanted to ask why is Perl, in comparison to other programming
  >> languages, so powerful in text processing? I read
  >> http://en.wikipedia.org/wiki/Perl#Features, and that doesn't really
  >> explain to me the answer. My motivation for this question is
  >> primarily due to interest and if someday someone asks me how is
  >> Perl good for biology (most biological data is stored as flat
  >> files).

  TB> I suspect I'll get heavily flamed by a few Perl powers for diving in
  TB> well beyond my skill and knowledge (and terminology use!) here, but I'm
  TB> also interested so I'll bite.  I suspect part of the answer may well be
  TB> the use of so may symbols in perl; $_, $&, `, ', ^ and so on.  Many
  TB> languages place a heavier weight on readability (and learnability?) than
  TB> Perl does.  In doing so, they sacrifice the terse symbol set that is
  TB> such a significant part of Perl.  Those symbols allow you express some
  TB> complex ideas... tersely.  Another aspect may well be the use of
  TB> contexts in Perl.  For example, if you evaluate something in list or
  TB> scalar context, you get something different in many (all?) cases  I'm
  TB> not particularly experienced in languages, but I've not seen that
  TB> elsewhere.  In an effort to avoid the worst of the flamage for going
  TB> beyond my depth, let me turn those ideas into questions;  Am I on the
  TB> right track, and hence is my (small but slowly growing) understanding of
  TB> Perl going in the right direction?

no flaming but you didn't answer the question. terseness has nothing to
do with powerful text processing.

  TB> Why is Perl particularly good for Biology?  No idea, but if you tasks
  TB> revolve around data manipulation using small purpose build utilities
  TB> rather than full blown massive complex GUI desktop applications then I
  TB> can see the attraction of Perl.  I know there are also plenty of Perl
  TB> 'massive complex' apps out there, but that doesn't seem to be the norm.

most biogenetic info is in very large text files. there is a very
popular package called bioperl that is commonly used to mung those
files. there is also a long history of perl and biology stemming back to
the story of how perl saved the human genome project. you should google
for the whole story but the gist is that genome sequencing was done in
many different labs around the world and there were over a dozen
different file formats. the author of the cgi.pm module wrote
translation modules (in perl of course) to convert the formats into each
other.

as for why perl is good (or great) for text processing the key to the
answer is its regular expressions. note how most every other language
today claims 'perl compatible regular expressions' in the same breath as
they slam perl! perl's regexes are still better and faster than the
compatible libraries. there are many things perl can do that they can't
even come close to (my favorite is the /e modifier on s///!).

cpan is another major reason for perl's strength in text processing.
there are hundreds if not thousands of modules that parse, mung,
generate text in all sorts of forms. just consider how many templaters
there are alone.

perl's scalar values are designed from the start to be powerful text
storage items. they have no fixed limit on size, you can add, cut,
shrink, extract, etc directly with operators instead of long winded
function calls. the perl ops and functions are designed to work well
together generating concise (a better word and more accurate than terse)
code. perl's guts have been optimized over many years and are very fast
when doing text munging.

so that is a short answer. in any case, perl IS the defacto language in
the biotech community and it will likely stay that way.

uri

-- 
Uri Guttman  ------  u...@stemsystems.com  --------  http://www.sysarch.com --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ----  http://bestfriendscocoa.com ---------

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to