On Wed, 2006-12-04 at 13:55 +0100, Dermot Paikkos wrote: > What I want to to find all users, say with the lc_surname =~ anderson > and ideally I'd like all the details for that user.
> use strict; > use warnings; > use diagnostics; > ... > ... > .. > > sub check_surname { > ############################### > # Open the users file and > # check that the user exists > # > # check_surname($name_to_check); > # return @list_to_names_found; > # > ################################ > > my $n = shift; > my $ary_users = retrieve($users); > die "Unabe to open $users\n" unless defined $ary_users; > > my $lc_surname = lc($n); > my @found_users; > for (my $i = 0;$i < @{$ary_users}; ++$i) { > if (defined($ary_users->[$i]->{$lc_surname}) ) { if( defiend( $ary_users->[$i]{lc_surname} ) && $ary_users->[$i]{lc_surname} eq 'anderson' ){ > print STDERR "Found \"$lc_surname\" \"$ary_users- > >[$i]->{lc_surname}\"\n"; > push(@found_users,$ary_users->[$i]->{$lc_surname}); > } > } > return(@found_users); > } > return(@found_users); > } > > -- __END__ Just my 0.00000002 million dollars worth, --- Shawn "For the things we have to learn before we can do them, we learn by doing them." Aristotle * Perl tutorials at http://perlmonks.org/?node=Tutorials * A searchable perldoc is at http://perldoc.perl.org/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>