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

Re: [MacPerl] Flat files and variable miles



On Wed, 31 Mar 1999, 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 really would like to keep a flat file solution...simplicity you know.
> 
Just out of curiosity, is this a scientific database? I'm trying to think
of something else real-world that would have 50-odd fields, and I'm
failing... :-)

You need to put parentheses around a 'my' list of variables like that. The
-w switch will warn you about it. Otherwise just the first variable is
lexically-scoped.

In any case, this example is where I think I would just assign to a LOL.
Something like (use of Data::Dumper just for illustration):

#!perl -w

use Data::Dumper; 

@data = ();
$idx = 0;
while (<DATA>) {
	$data[$idx++] = [ split ];
}

print Dumper([@data]); 

__END__
1.2 500 abd 1313
1.3 600 cde 2424
1.4 700 fgh 3535



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