[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Flat files and variable miles



Just some style suggestions ...

At 09.29 -0500 1999.03.31, Greenblatt & Seay wrote:
>$fieldNames = "lastName,firstName,phone,address,etc.";
>@fields = split(",",$fieldNames);

This can be shortened to:

  @fields = qw(last first phone address
    foo bar baz buz etc ad nauseum forever);

qw() is the same thing as split(/\s+/, $foo), where the contents
of qw() is a white-space separated list of tokens.  If your tokens
contain whitespace, it won't work, or course.  Also, if your tokens
contain ',' or '#', you will get a warning.


>	for($flds=0;$flds<@fields;flds++);

Here, i would just prefer:

  for my $n (0 .. @fields) {

--
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])

===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org