use of next versus last in a nested loop algorithm

this is my last question of the day, i promise.

the code below is doing something very straightforward : i may have a
datelist array say ( 200601, 200603, 200602) and a filelist array say
( eurusd.20060123.txt, eurusd.20060523.txt, eurusd.20060622.txt ). all
i want to do is write the .txt string to a file whenever there is a
match between it and any of the items in the datelist array. i think
below will work but i haven't tested it yet. but, my question is not
really about the code below exactly. filelist can have tons of items in
it, so if there is a match, i want to get
out of the foreach my $pat loop and go to the next $item in the
foreach my $item loop on the outside. i've read about next and last in
various books and still i can't tell what to use because
my case is a little different than the examples in the books because i
am comparing values in
the two loops to decide when to get out. therefore, i don't think
whatever statement i use, next
or last, can go in the if statement ?

foreach my $item (@filelist) {
foreach my $pat (@datelist2array) {
if ( $item =~ /$pat/ ) {
print $out_file2 "$item \n";

thanks a lot. i'm very sorry to bother everyone.