Thanks for the helpful replies. I got it to work the way I need it to, and managed to address the warnings in regards to uninitialized variables and such. Here's the code for possible feedback:
open(FILE,"<",$DATA_FILE);
my @PRC_PRIV = <FILE>;
my @PRC_PRIV_ONLY = grep /Run as/ .. /^ /, @PRC_PRIV;
foreach $PRIV(@PRC_PRIV_ONLY) {
chomp($PRIV);
next if ($PRIV =~ m/Run|^ /);
($USER, $HOSTN, $CMDN) = split(" ", $PRIV, 3);
if (defined($USER)) {
print "$PRC_GRP,$USER,$HOSTN,$CMDN \n";
}
Any feedback welcome.
|