http://qs1969.pair.com?node_id=510262


in reply to Re^2: Infinity loop
in thread Infinity loop

Well you could avoid the temporary variable by using //g in a LIST context instead. I wouldn't recommend it if the temporary list was likely to be of non-trivial size.
for ( $_[0]->seq() =~ /CG/g ) { ++$CG }
If course if the body of your loop is really just ++$CG then all you are doing is counting the number of elements in the list. In that case the "pimply-goatse-operator" mentioned earlier in ths thread is what you want.