On Dec 22, 2003, at 5:05 AM, NYIMI Jose (BMB) wrote:
[..]
I'm wondering if you really need
to read a script into an array ?
Ugly for me ;)
[..]
I agree with you, it is clearly not making sense
why one would want that as a pattern - it clearly
can be done:
my $username = 'drieux';
my @alt_cmd = qw/ps -fu/;
my @cmd = qw/ps -aU/;
my @response = [EMAIL PROTECTED] $username`;
foreach my $line (@response)
{
print $line;
}
If anything, the idea of running a hash of arguments
to a command has some value:
my $username = 'drieux';
my $ps_args = {
'broken' => '-fu',
'smallUser' => '-aU',
'bigUser' => '-axwwU'
};
foreach my $key (keys %$ps_args)
{
print "running with args: $ps_args->{$key}\n";
my @response = `ps $ps_args->{$key} $username`;
foreach my $line (@response)
{
print $line;
}
}
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>