Exitting from while loop

i am using one Xbase module for accessing DBF files.
I am using two dbf files for generating some reports. i want to generate reports based on the first dbf file . but one required field is in second dbf file. so for each record in first dbf file, i am searching that record in second dbf file also. if i found that record in second dbf file , i want to exit from that while loop. for this i given exit command in perl. but it is exiting from the whole perl program.
ie i am getting only one record in the recport. so how to exit from the loop.
$database="first file"
$data1 ="second dbf"
$user = $fields[11];
if ($fields[0] eq $dataf[0])
$fg = $dataf[1];
exit ---
@dataf = $data1->get_record;
print <<endresult;
<TD><B><FONT FACE="Arial,Helvetica"><FONT COLOR="#660000">User ID            </FONT></FONT></TD>
<TD><B><FONT FACE="Arial,Helvetica"><FONT COLOR="#000099">$fields[11] </FONT></FONT></TD>
@fields = $database->get_record;
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

use 'last' instead of 'exit'


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
In Perl the statement 'last' is just like 'break' in C.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.