in reply to incorrect results

_Wild_ guess, but you're comparing $first->{$t1}->{$array[$i]} using ==.

That works fine for numbers.

But then you're using "chomp", which makes sense for a newline-terminated string.

Are you sure you wanted == in your unless, rather than eq?


Mike

Replies are listed 'Best First'.
Re^2: incorrect results
by Anonymous Monk on Apr 30, 2007 at 21:13 UTC
    There are both integers and strings in the compared values.
      There are both integers and strings in the compared values.

      (Caveat: I've not been following the previous discussion.)

      Strictly speaking this does not make sense. Even more strictly you can use Scalar::Util's dualvar() to create a scalar that will have two completely unrelated values in "numeric context" and in "string context" (note that these are not even precisely defined in Perl 5) respectively, but take this as an aside: generally perl will do what you mean in a very convenient way, with automatic conversions between numbers and strings. So you probably have strings that may occasionally look like numbers and you may want to sort numerically in the latter case. You may also want to do some checks to verify if that is the case.

        when I am printing I tried sorting the data saperatly into digits and integers. But it doesnt seem to be working. FOr some reason the when printing its not able to disassociate the variable for only on particular parameter value. Now when I run the ssh exclusively for the particular server, then the printout seems to look as expected. The confusion comes up when the ssh is running on multiple servers.
        I corrected the data structure and its working now. thank u
    A reply falls below the community's threshold of quality. You may see it by logging in.