in reply to display one time only

If I understand you correctly, then I think all you need to do is use the keyword last:

foreach my $j (1,2) { if ( !exists( ${"Name_$j"} )) { # # print your stuff here # last; } }
"last" tells perl to immediately exit the loop.

rje