princepawn has asked for the wisdom of the Perl Monks concerning the following question:
Can someone tell me why rules and rules2 are not being bound by the use of scalar grep? Any help is appreciated.
{ my @DRIVER = Alzabo::Driver->available; my @RULE = Alzabo::RDBMSRules->available; my $sg = (scalar grep { $p{rdbms} eq $_ } Alzabo::RDBMSRules->av +ailable); warn Data::Dumper->Dump([\@DRIVER, \@RULE, $sg], [qw(DRIVER RULE + sg)] ); my %has = ( driver => grep { $p{rdbms} eq $_ } Alzabo::Driver->available, rules => (scalar grep { $p{rdbms} eq $_ } Alzabo::RDBMSRules->av +ailable) ? 'yes' : 'no', rules2 => (scalar grep { $p{rdbms} eq $_ } Alzabo::RDBMSRules->av +ailable) ); use Data::Dumper; die Dumper(\%has);
Carter's compass: I know I'm on the right track when by deleting something, I'm adding functionality~/hacks/gerbold/scripts $ perl s.pl $DRIVER = [ 'Gerbold', 'MySQL', 'PostgreSQL' ]; $RULE = [ 'MySQL', 'PostgreSQL' ]; $sg = 0; $VAR1 = { 'driver' => 'Gerbold' }; ~/hacks/gerbold/scripts $
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: scalar grep not binding hash slots
by japhy (Canon) on Nov 11, 2003 at 23:56 UTC | |
|
Re: scalar grep not binding hash slots
by Roger (Parson) on Nov 11, 2003 at 23:26 UTC | |
|
Re: scalar grep not binding hash slots
by ysth (Canon) on Nov 11, 2003 at 23:30 UTC |