Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^3: Infinity loop

by nobull (Friar)
on Nov 20, 2005 at 17:59 UTC ( #510262=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://510262]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2021-04-11 01:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?