Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re^9: Need help comparing 4 dates (Fixed.)

by BrowserUk (Pope)
on Oct 04, 2010 at 00:27 UTC ( #863216=note: print w/replies, xml ) Need Help??

in reply to Re^8: Need help comparing 4 dates (Fixed.)
in thread Need help comparing 4 dates

Actually, nevermind about the blank line in the result set. I see that yours has it also. Must come from the "+1" in the print.

Erm, no. The header line, and the following blank line in the output, are printed by this line:

print scalar <DATA>;

It has one newline because I didn't chomp it. And the second, because I have -l on the hashbang line:

#! perl -slw

Which has the affect of automatically adding "\n" to the end of every print line.

The +1 in this line:

print join "\t", $label, map $_+1, sort{ $order[ $a ] <=> $order[ $b ] } 0 .. $#order;

converts the numbers 0 .. 3 used to index the array while sorting. into the numbers 1 .. 4 used for your desired output.

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2018-03-23 05:45 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (288 votes). Check out past polls.