I have the following code in perl that tries to find a string '$dataset' in the keys of %samples_runs and stores it in an array
} elsif ( my @matches = grep /$dataset/, keys %samples_runs ) {
my @values = @samples_runs{@matches};
foreach my $match (@matches) {
# do something
}
However, if the 'keys %samples_runs' starts with "prefix-1-1", I don't want this to be considered as a match.
So when there is a match, this will evaluate to true 'grep /$dataset/, keys %samples_runs'. But when there is a match AND the keys%samples_runs starts with 'prefix-1-1', nothing should be added to the @matches array.
How can I implement this?