#!/usr/bin/env perl use strict; use utf8; use warnings; my ($h, $_) = split(/ /, <>); chomp $h; my $count = 1; while (defined(my $hi = <>)) { chomp $hi; $count += ($h < $hi) ? 1 : 0; } if ($count =~ /1$/) { print $count . "st\n" } elsif ($count =~ /2$/) { print $count . "nd\n" } elsif ($count =~ /3$/) { printf $count . "rd\n" } else { printf $count . "th\n" }