el-moe has asked for the wisdom of the Perl Monks concerning the following question:
I have started to really do some wierd things lately and I was wondering if I'm developing a poor style. I realize that TIMTOWTDI so maybe what I'm really asking is... "is there a much better way?"
I have two chunks of code to show you... maybe you can give some advice.
The first is just to populate a single var... I ended up doing this:
$header{"Number of Drills"} = &{ sub { my $ret; foreach my $l ( @drill_arr ) { foreach ( values %{$l->tool} +) { $ret += $_->count; } } return $ret; } };
The next is to get the elements I want from an array of hashes:
my @layer_list = grep { $_->{layer_type} eq "signal" || $_->{layer_type} eq "mixed" || $_->{layer_type} eq "power_ground" } grep { $_->{context} eq "board" } @matrix_array;
these both work but have been nagging me some so I wanted to show you all in the hopes you could set me straight if need be.
Thanks for your help
Prost,
Moe
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Am I developing poor style?
by btrott (Parson) on Jan 17, 2001 at 00:49 UTC | |
by tye (Sage) on Jan 17, 2001 at 00:56 UTC | |
|
Re: Am I developing poor style?
by chipmunk (Parson) on Jan 17, 2001 at 00:43 UTC | |
|
(tye)Re: Am I developing poor style?
by tye (Sage) on Jan 17, 2001 at 00:41 UTC | |
|
Re: Am I developing poor style?
by chromatic (Archbishop) on Jan 17, 2001 at 01:01 UTC | |
|
Understanding Structures through Variable Names
by tedv (Pilgrim) on Jan 17, 2001 at 04:24 UTC | |
|
Re: Am I developing poor style?
by coreolyn (Parson) on Jan 17, 2001 at 00:48 UTC | |
|
(tye)Re2: Am I developing poor style?
by tye (Sage) on Jan 17, 2001 at 00:52 UTC | |
|
Re: Am I developing poor style?
by Anonymous Monk on Jan 17, 2001 at 00:36 UTC | |
|
Re: Am I developing poor style?
by el-moe (Scribe) on Jan 17, 2001 at 23:57 UTC |