Hi there,
I am hoping to figure out the best Way to write something. I have two
arrays @previous_hostnames and @hostnames.
I want to figure out if there is at least one matching element in
@previous_hostnames that is found in @hostnames.
What about finding all matching elements.
I suppose I can write for loops like this:
for my $hostname (@hostnames) {
for my $previous_hostname (@previous_hostnames) {
if ($hostname == $previous_hostname) {
$found = 1;
last;
}
}
last if $found;
}
is there another way?
Cheers,
Noah
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/