Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: Finding the max()/min()

by monoxide (Beadle)
on Nov 11, 2004 at 03:27 UTC ( #406899=note: print w/replies, xml ) Need Help??

in reply to Finding the max()/min()

A bit longer (just a little bit) but here goes. I realise that it can probably be shortened, but in the interests of brevity and my sanity here is the longer version.
max(3,4); sub max { ($x,$y)=@_;@xd=split//,$x; if(length($x) != length($y)) { return $x if(length($x)>length($y)); return $y if(length($y)>length($x)); } @yd=split//,$y; for($i;$i<length($x);$i++) { if (ord($xd[$i])!= ord($yd[$i])) { return $y if( ord($y)>ord($x) ); return $y if(ord ($y) >ord($x )); } } } # *** UNTESTED *** # It could be used to compare binary values, # but i suppose that is outside the scope of # this post.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (8)
As of 2017-02-25 17:01 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (366 votes). Check out past polls.