[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: : All, : : I have a foreach statement that is going through a file and : looking for all line w/out *Orig and what I want to do is if : its return code was 0 then print out a short message, but I do : not want to print out this short message more than n +1 times. : Any ideas? : : Here is my code: :
# Assume n = 4 my $no_tapes_print_count = 5; : foreach (split /\n/, $lvimgDC_nonactive_tapelist ) { : : if ( /\((E\d+)/ ) { : local $, = "\t"; : print OUT "$1\n" unless substr($_, 0, 5) eq '*Orig'; : if ( $? == 0 ) { if ( $? == 0 and $no_tapes_print_count ) { $no_tapes_print_count--; : print "There are no vault tapes today for lvimg : DC drives \n"; : } : } : } HTH, Charles K. Clarkson -- Mobile Homes Specialist 254 968-8328 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>