open($fh, "command |") or die "command wouldn't run...because $!\n"; @output = <$fh>; #### my $command = "/usr/local/mysql/bin/mysql -u anonymous " . "-h my.database.org ". "--execute='show databases'"; open($fh, "$command |") or die "Could not execute $command because $!\n"; @results = <$fh>; @results = grep { /$temp_choice/} @results; #### while(<$fh>) { do_something if /$temp_choice/; }