Hello Monks,
I'm getting an error which I believe I'm trying to use a hash which consist of a number and compare to see if that number is given. If it is, then I want to print out a string. Unfortunately, I get this error:
Argument "2EN" isn't numeric in eq at Calsdiscrete.pl line 71
This is my code:
if (($cals_info {$cals_type} {low_count_no} ==
$cals_info {$cals_type} {high_count_no}) == 0){<br>
print ($cals_info {$cals_type} {$cals_state_0});<br>
}<br>
else<br>
{ <br>
if (($cals_info {$cals_type} {low_count_no} ==
$cals_info {$cals_type} {high_count_no}) == 1){ <br>
print ($cals_info {$cals_type} {$cals_state_1});<br>
}<br>
}<br>
Can you tell me what I'm doing wrong?
My text file is this:
"A1","BL1CHILDB0","0","0","OFF"
"A1","BL1CHILDB0","1","1","ON"
"A1","BL1CHILDB1","0","0","DIS"
"A1","BL1CHILDB1","1","1","ENA"
"A1","BL1CHILDB2","0","0","ZERO"
"A1","BL1CHILDB2","1","1","ONE"
"A1","BL1CHILDB3","0","0","DAN"
"A1","BL1CHILDB3","1","1","JOHN"
"A1","BL1CHILDB4","0","0","RICH"
"A1","BL1CHILDB4","1","1","MARK"
"A1","BL2CHILDB5","0","0","OFF"
"A1","BL2CHILDB5","1","1","ON"
"A1","BL2CHILDB6","0","0","OFF"
"A1","BL2CHILDB6","1","1","ON"
"A1","D1CHILDB0","0","0","OFF"
"A1","D1CHILDB0","1","1","ON"
"A1","D2CHILDB1T3","0","3","0T3"
"A1","D2CHILDB1T3","4","5","4T5"
"A1","D2CHILDB1T3","6","7","6T7"
"A1","D3CHILDB4T5","0","0","DIS"
"A1","D3CHILDB4T5","1","1","1EN"
"A1","D3CHILDB4T5","2","2","2EN"
"A1","D3CHILDB4T5","3","3","12EN"
"A1","D4CHILDB6","0","0","OFF"
"A1","D4CHILDB6","1","1","ON"
I'm reading the two columns of numbers and I want to print the last column. ex. (on,off)
203-06-21 edit ybiC: <tt>, <code> and <p> tags
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.