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

Re: [MacPerl] Flat files and variable miles



At 08.18 -0500 1999.03.31, Jefferson R. Lowrey wrote:
>At 7:10 AM -0500 3/31/99, Allan Greenier wrote:
>>Greetings,
>>I posted a general question last week about doing a CGI script using a
>>flat file version of a Filemaker database.
>>Noe that I've gotten a look at the database, it's record is about 50
>>fields long! So to put each line in a variable would look something
>>like:
>>
>>my $Var1,$Var2,$Var3..$Var50 = @_
>>
>>Will this work? Or is it impractible?
>
>I expect it should work.  It does seem rather impractical though.
>
>If I were using Fortran, I'd use an array and name 50 constants to access
>each element of the array.
>
>In perl, I expect one should think hash.

If all you want are numbered variables, use an array and index them by the
number.

  my(@values) = @_;
  print $value[0], $value[49];

If you want the first one to be 1 not 0, stick an extra value in there:

  my(@values) = ('', @_);

Or something.

If you want names, then you a hash is probably best.


--
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