Help for this page
open IN, $file or die "Cannot open $file for input: $!\n"; while( <IN> ) { # do your if-flag-two-step } close IN;