in reply to print a hash

perl -pi.bak -e'$_="" if $unique{$_}++' <yourfile>

Your original file will be moved to one with a .bak extension and the version with only unique lines will be left named as the original

Update

Whoops, missed the fact that the OP grabs the last digits off the line and checks the uniqueness of them, not the entire line, this may be more to your liking

perl -pi.bak -e'$_=/(\d+)/?$1:"";$_="" if $seen{$_}++' <yourfile>

Cheers,
R.

Pereant, qui ante nos nostra dixerunt!