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

Re: [MacPerl] Flat files and variable miles



At 5:20 PM +0000 4/1/99, Bart Lateur wrote:
>On Wed, 31 Mar 1999 09:53:01 -0500, Chris Nandor wrote:
>
>>>	for($flds=0;$flds<@fields;flds++);
>>
>>Here, i would just prefer:
>>
>>  for my $n (0 .. @fields) {
>
>
>  for my $n (0 .. $#fields) {

Or just chuck the loop and use a slice, replacing

	@recordFlds = split($fieldDelimiter,$_);
	for($flds=0;$flds<@fields;flds++);
		$field{$fields[$flds]} = $recordFlds[$flds];
	}

with 

	@field{@fields} = split($fieldDelimiter, $_);

Shorter, simpler (note the two errors in the original), and
executes faster to boot!

Jim
--
Jim Miner          jfm@winternet.com

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