Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: substituting values in an array

by Laurent_R (Canon)
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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1039631]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2017-11-25 12:33 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (355 votes). Check out past polls.