Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re: loop to remove negatives

by Eliya (Vicar)
on May 14, 2012 at 19:14 UTC ( #970489=note: print w/replies, xml ) Need Help??

in reply to loop to remove negatives

Use the aliasing feature of for

for ($busi1, $busi2, $busi3) { s/-//g; }

I.e., the indidual items you loop over are being aliased to $_ in this case.

Or use an array instead of individual variables named $var1, $var2, ..., in which case the above would reduce to

for (@busi) { s/-//g; }

(But naturally, when you want to refer to a single value only in other places of your code, you'd then have to say, for example, $busi[2])

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://970489]
[Lady_Aleena]: atcroft, this is the last of the printing modules I am going to make stop printing, I think.
[Lady_Aleena]: It will leave me with 8 out of 138 modules that print something.
[atcroft]: Sounds like it will make display modifications a little easier when you are done, at least.

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2017-05-29 02:41 GMT
Find Nodes?
    Voting Booth?