in reply to Help with for loop

This line of code:

    print (grep /$backup_job/, <NB_FILE>);

reads the whole file and positions the filehandler at the end of the file. Therefore, next time in the for loop, you don't read anything from the file. You should probazbly loazd your file into an array and then read through the aerray.