Re: Enum

2007-04-13 Thread Chas Owens
On 4/13/07, yitzle <[EMAIL PROTECTED]> wrote: snip > @record{qw(firstName lastName field3 field4)} = split /\t/; This line sorta confuses me. Now record is treated as an array? An array element which is a hash? On the next line, you push it as a hash onto @data. This makes an array of hashes? sn

Re: Enum

2007-04-13 Thread yitzle
BANG! There's no need to assign names to array indices when you have Perl's hash structure. Suppose your data is tab-separated, you could write: my @data; while (<>) { my %record; @record{qw(firstName lastName field3 field4)} = split /\t/; push @data, \%record; } or something similar. No

Re: Enum

2007-04-13 Thread Rob Dixon
yitzle wrote: Rob Dixon wrote: yitzle wrote: Don't shoot me! I can't find enum on the perldocs. Perl does have an enum, right? How do I go about making an enum? I basically want a bunch of variables to equal subsequent values, eg 0, 1, 2, ... Perl doesn't provide enum natively. But it's a

Re: Enum

2007-04-13 Thread yitzle
The "problem" is thus. I an reading in data and using split to get it to an array. Each element/column has a specific meaning, eg firstName, lastName etc Rather than using [0], [1] I figured I could set up an enum($firstName, $lastName, etc) I suppose the alternative is to define (constant or vari

Re: Enum

2007-04-13 Thread Rob Dixon
yitzle wrote: Don't shoot me! I can't find enum on the perldocs. Perl does have an enum, right? How do I go about making an enum? I basically want a bunch of variables to equal subsequent values, eg 0, 1, 2, ... Perl doesn't provide enum natively. But it's a solution to a problem, so perhaps y

Re: Enum

2007-04-12 Thread Jeff Pang
Are you looking for C style enumerated types? AFAIK,Perl doesn't have this built-in type.But you could get it on CPAN: http://search.cpan.org/~zenin/enum-1.016/enum.pm 2007/4/13, yitzle <[EMAIL PROTECTED]>: Don't shoot me! I can't find enum on the perldocs. Perl does have an enum, right? How d