Andrew Gaffney wrote:
I'm writing a Perl program to uninstall a whole package tree, such as KDE or Gnome. Here's my code so far:


#! /usr/bin/perl



my @pkgs, $line;



open QUERY, "emerge --nospinner -ep gnome |"; foreach $line (<QUERY>) { $line =~ s/\[.+\] (.+) /$1/; chomp $line; print "${line}\n"; # $line =~ /(.+)\/(.+)-(\d.+)/; push @pkgs, $line; } close QUERY;

foreach $line (@pkgs) {
  print "This is a package: $line\n";
}

When I try to access @pkgs after this, there is no data in it. It prints 'This is a package: ' once and exits with no error. I know its getting the data correctly, because it prints a list of all the packages on the screen. What am I doing wrong?

Nevermind. This code is simplified from what I was doing. I forgot to get rid of blank lines. I was then feeding the blank lines to qpkg as an argument causing it to just sit there and do nothing.


--
Andrew Gaffney


-- [EMAIL PROTECTED] mailing list



Reply via email to