while () { print if /some_regexp/; } #### print "$1 $2 (..etc)\n" if /some regexp with captures/;