#!/usr/bin/perl -w use strict; my(%hash,$i); @hash{map($i++.":$_", <>)} = (); print "$_\n" for map /^\d+:(.*)/, keys %hash;