while ( ) { if ( /^(1|3|4) perlmonks\(([^\)])\)/ ) { print "$2\n"; } }