if (grep /.bz2/, $fileName) { $isBz2 = 1 ; } else { $isBz2 = 0 ; } ... while ( ! (grep /node/, $line) ) {