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 nativ

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

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

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 hav

Enum

2007-04-12 Thread yitzle
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, ... Thanks!

RE: Simulating VB Enum

2003-08-28 Thread Dan Muey
Not a vb person myself but would a hash do that then: my %enum = ( ASSET => 1, LIABILITY => 2, EQUITY => 3, REVENUE => 4, EXPENSE => 5, DIVIDEND => 6, CONTRA_ASSET => 11, ); Or is Vb's enum like mysql's enum? I ask since you where doing a sel

Re: Simulating VB Enum

2003-08-28 Thread R. Joseph Newton
Dan Muey wrote: > In addtion to Rob's very sound advice it sound like you simply need an array: > > my @enum = qw(dhbold dhcaption dhend dhform); > > print $enum[0]; # prints dhbold > print $enum[2]; # prints dbhend > > HTH > > DMuey Sorry Dan, I dn't th

RE: Simulating VB Enum

2003-08-27 Thread Dan Muey
> Remember these 3 words... search.cpan.org ;) > > http://search.cpan.org/search?query=enum&mode=all > > CPAN is always the best place to start looking for code. > > On the results page is looks like "enum" will do what you need. > > Rob > In addt

Re: Simulating VB Enum

2003-08-27 Thread James Edward Gray II
On Wednesday, August 27, 2003, at 02:35 PM, Harter, Douglas wrote: Visual Basic has a construct called Enum which looks like so: Enum namea dhbold dhcaption dhend dhform . end enum What it essentially does is assign an incrementing numeric value to each

RE: Simulating VB Enum

2003-08-27 Thread Hanson, Rob
Remember these 3 words... search.cpan.org ;) http://search.cpan.org/search?query=enum&mode=all CPAN is always the best place to start looking for code. On the results page is looks like "enum" will do what you need. Rob -Original Message- From: Harter, Douglas

Simulating VB Enum

2003-08-27 Thread Harter, Douglas
Visual Basic has a construct called Enum which looks like so: Enum namea dhbold dhcaption dhend dhform . end enum What it essentially does is assign an incrementing numeric value to each variable in the enum, so that dhbold = 1 dhcaption = 2 dhend = 3 dh form

Re: problem in writing code(switch/case)or enum

2001-10-04 Thread Bill Jones
On 10/4/01 2:54 AM, "Rahul Garg" <[EMAIL PROTECTED]> wrote: > what i want is : > > $s_month can be 1 to 12 > if($s_month == 1){$s_month = 'JAN'};and so on > how can i do it. ? http://www.cpan.org/authors/id/S/SN/SNEEX/cal.perl_v2A HTH/-Sx- :] -- To unsubscribe, e-mail: [EMAIL PROTECT

RE: problem in writing code(switch/case)or enum

2001-10-03 Thread Gibbs Tanton - tgibbs
)or enum what i want is : $s_month can be 1 to 12 if($s_month == 1){$s_month = 'JAN'};and so on how can i do it. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

problem in writing code(switch/case)or enum

2001-10-03 Thread Rahul Garg
what i want is : $s_month can be 1 to 12 if($s_month == 1){$s_month = 'JAN'};and so on how can i do it.