#!/usr/sph/bin/perl -w use strict; # reverses the lines in a file, and prints them my $home=$ENV{HOME}; open(FILE, "< $ARGV[0]") or die "Couldn't open $ARGV[0] for reading.\n"; my @lines=; my %seen = (); my @uniq = (); foreach my $item (@lines) { $item =~ s/$home/~/; push(@uniq, $item) unless $seen{$item}++; } while (my $line = pop @uniq) { print $line; }