while () { print if /Port\s+$port\b/ .. /^#---/ && last; }