On Aug 22, 6:18 am, [EMAIL PROTECTED] (Alexandru Maximciuc) wrote: > Hello Chris, > > Wednesday, August 22, 2007, 7:44:02 AM, you wrote: > > > I am working a script that is a solution to a problem in Intermediate > > Perl. Here is the script: > > #!/usr/bin/perl -w > > use strict; > > sub check_items_for_all { > > my $all_ref = @_; > > here is the first err: you should have smthing like > my ($all_ref) = @_; > or > my $all_ref = shift @_; > > > my @who = keys %$all_ref; > > my @required = qw(preserver sunscreen water_bottle jacket); > > my @missing = ( ); > > for my $crew (@who){ > > for my $item(@required){ > > unless (grep $item eq $_, %$all_ref{$crew}) { > > this does the job well (I think :) ) > unless (grep $item eq $_, $all_ref->{$crew}) {
That's the same as unless ($item eq $all_ref->{$crew}) { But $all_ref->{$crew} is an array ref so I thing the OP meant unless (grep $item eq $_, @{$all_ref->{$crew}}) { However the double loop (grep is a loop) implies you've got the wrong structure. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/