#!perl -p use strict; use warnings; if ( /^\s*[#\n]/ or !s/.*{([^}]+).*$/$1/ ) { $_ = <>; last if !defined $_; redo; }