Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
laziness, impatience, and hubris
 
PerlMonks  

Re: substituting values in an array

by Laurent_R (Priest)
on Jun 18, 2013 at 19:01 UTC ( #1039631=note: print w/ replies, xml ) Need Help??


in reply to substituting values in an array

if ($array[$i] gt '200') { # ...

Good solutions have been provided to you, I would just like to point out to a severe error in your code that has not been picked up so far if I have read correctly.

If you want to compare numbers numerically (I mean arithmetical comparison), don't use the gt operator. If your array contains the element 1500, this will be deemed to be smaller than 200, because gt makes some form of lexical (or lexicographical, whatever) comparison (and 1 is smaller than 2). This is obviously not what you want. In brief, in such a case you want to use the > operator, rather than gt.


Comment on Re: substituting values in an array
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2014-04-20 22:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (489 votes), past polls