Ruby, 57
Ruby, 60
It's not as good as the Perl entry, but I figured I'd work on my Ruby skills.
def o(n)n.to_s+%w{th st nd rd}[n/10==1||n%10>310%10==1||n%10>3?0:n%10]end
Function takes one integer argument, n
, and returns a string as the ordinal form.
Works according to the following logic:
If the tens digit is a 1 or the ones digit is greater than 3 use the suffix 'th'; otherwise find the suffix from the array ['th', 'st', 'nd', 'rd'] using the final digit as the index.