Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^3: Infinity loop

by nobull (Friar)
on Nov 20, 2005 at 17:59 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://510262]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2024-04-16 14:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found