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

Re: [FWP] Problem - rewrite and simplify






The problem is an instance of the general situation of
a C programmer doing some weird machination with
indexes which is rendered obsolete by the semanticly
direct foreach(split...){... idiom.


The split could be fiddled a little to
gobble extra whitespace; and post-split data massaging could
be added to coerce everything to lowercase,
s/\W//g; and the like, for greater flexibility in accepting
unpredictable user idiocy.




Vicki Brown wrote:
> BEFORE:
>           while ($line = <CLONEIDSLIST>) {
>             chop ($line);
>             until (index($line, ', ',0)< 0) {
>                  $ids[$count++] = substr($line,0,index($line,', ',0));
>                  $line = substr($line, index($line, ', ',0) + 2);
>             }
>             $ids[$count] = substr($line,0);
>           }
> 

> AFTER:
>          while ($line = <CLONEIDSLIST>) {
>              chop($line);
>              push(@ids, split(/, /, $line));
>           }



Furthermore, 
this e-mail is an instance of the general idiom of an individual
repeating what e believes to be politically correct dogma in an
effort to gain status.



________________________________________________________________________
  David Nicol 816.235.1187 UMKC Network Operations david@news.umkc.edu
     "on a 80x24 character cell terminal in a damp basement, under
       a bare light bulb, perched atop a backless wooden stool."

==== Want to unsubscribe from Fun With Perl?
==== Well, if you insist... Send mail with body "unsubscribe" to
==== fwp-request@technofile.org