penguinfuz has asked for the wisdom of the Perl Monks concerning the following question:
This iterates through (while begging for optimization) a listing of installed RPMs, and matches against a listing of RPMs installed at build time, Any deviation, either version update or new software package is printed to the screen.#! /usr/bin/perl -w use strict; my @current = `rpm -qa`; my @base = `cat /tmp/install.log`; my $cur_cnt = @current; my $base_cnt = @base; $cur_cnt -= 1; $base_cnt -= 1; foreach (@current) { # Reset to stay out of the negative when decrementing below. $base_cnt = @base; # Set these because the first iteration through the # loop gripes about unitialized value. $cur_cnt -= 1; $base_cnt -= 1; foreach (@base) { if ($base[$base_cnt] =~ $current[$cur_cnt]) { print "Unchanged: $base[$base_cnt]"; } else { #Do Nothing } $base_cnt -= 1; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Escaping characters in the array
by tadman (Prior) on May 30, 2002 at 21:45 UTC | |
|
Re: Escaping characters in the array
by particle (Vicar) on May 30, 2002 at 21:28 UTC | |
|
Re: Escaping characters in the array
by penguinfuz (Pilgrim) on May 31, 2002 at 13:55 UTC |