#!/usr/bin/perl -w use Getopt::Std; use vars qw($opt_h $opt_n); $index = 0; &init; open(ORDER, "patch_order") || die "No patch_order file found, exiting\n"; while () { $patches[$index] = $_ ; $index++; } close(ORDER); if ($opt_n) { print reverse @patches; } else { foreach $patch ( reverse @patches ) { print "Uninstalling Patch $patch...\n"; system ("/usr/sbin/patchrm $patch"); } } sub init { getopts('hn'); if ($opt_h) { &usage; } } sub usage { print "Usage: $0 [-n]\n"; exit 1; }