in reply to Search an Array Question
#!/usr/bin/perl -w use strict; my $bug_no = shift; my $committer = shift; my @array =("16410 88 bhorwat, dpotte1, jbehr, lgrimes", "16412 88 pputta1", "16413 88 gkothi, aandy"); my %hash; foreach(@array){ #remove those commas s/,//g; #get your bug id and a list of devs my ($bug_id,undef,@dev) = split/\s+/,$_; foreach(@dev){ #dont really need data in the hash only the key $hash{$bug_id}{$_} = $_; } } #this can be a loop if you have many bugs and committer combos if(!defined($hash{$bug_no}{$committer})){ print "Committer $committer is not assigned to Bug $bug_no"; }
|
|---|