sorting pathnames by basename

bscott at ntisys.com bscott at ntisys.com
Tue Aug 20 11:19:20 EDT 2002


On Tue, 20 Aug 2002, at 10:45am, Derek D. Martin wrote:
> Programming Perl seems to almost, but not quite recognize how painful
> these things are to learn, by offering mnemonic devicess for each of
> them.

  use English;

  That is not just an idle comment; it refers to the fact that Perl does
recognize that these variables *are* cryptic, and provides a mechanism to

  As for why many people still use the funny-character variables: It is
partly because 'use English' carries a performance penalty for some
implementations, but mostly because the funny-character variables came
first.

> Here are two ways to do (more or less) the same thing, one in C and one in
> Perl:
> 
>   setlinebuf( file );
>   $| = 1;

  Here are two days to do (more or less) the same thing, one on Unix and one 
on MS-Windows:

	findstr foo myfile.txt
	grep foo myfile.txt

  Without knowing either of the two OSes, which is more self-documenting?  
Which is more obscure?

> Well, there are certainly people who like to write obscure C as well. It
> just seems to be part of the Perl culture...  I've seen far less readable
> Perl than C.

  I think a large part of Perl's reputation for being line noise is that
Perl makes heavy use of regular expressions, which *do* look like line noise.  
Fortunately, however, Perl provides a mechanism for that, too, and is the
only languages I know of that does -- the /x modifier allows one to embed
whitespace and comments in a regular expression.

-- 
Ben Scott <bscott at ntisys.com>
| The opinions expressed in this message are those of the author and do not |
| necessarily represent the views or policy of any other person, entity or  |
| organization.  All information is provided without warranty of any kind.  |







More information about the gnhlug-discuss mailing list