while( m/REGEX/g ) { ... # use groups only if match successful }