in reply to (jeffa) Re: array newbie...(sigh)
in thread array newbie...(sigh)

Well i tried it but it just gives me a list like this: netmanjobmanmailmanbatchmanwriter (acts like the grep isn't even working?) also how do is store the output from the array into a variable ( I need the final number to read: 1113112
my @arraylist = qw(netman jobman mailman batchman writer); foreach my $process (@arraylist) { `ps -ef|grep -i $process|grep -v grep|wc -l`; } chomp @arraylist; #\s+/ /g for @h; print @arraylist; #@h = ($netman= `ps -ef|grep -i netman|grep -v grep|wc -l`, # $jobman= `ps -ef|grep -i jobman|grep -v grep|wc -l`, # $mailman= `ps -ef|grep -i mailman|grep -v grep|wc -l`, # $batchman= `ps -ef|grep -i batchman|grep -v grep|wc -l`, # $writer= `ps -ef|grep -i writer|grep -v grep|wc -l` # ); #%h = ("a", "$netman", "b", "$jobman", "c", "$mailman", "d", "$batchma +n", "e", "$writer"); #@h = ("$netman","$jobman","$mailman","$batchman","$writer"); #chomp @h; #\s+/ /g for @h; #@h > ;

Replies are listed 'Best First'.
(jeffa) 3Re: array newbie...(sigh)
by jeffa (Bishop) on Mar 15, 2002 at 22:25 UTC
    Wow. I can honestly say that you have completely lost me! :D

    I recommed you do what PrakashK offered for you. He is absolutely correct in his method, and i think you should really study that. The snippet that i gave you is unfortunately not very practical, i just wanted to demonstrate how to iterate through an array.

    jeffa

    L-LL-L--L-LL-L--L-LL-L--
    -R--R-RR-R--R-RR-R--R-RR
    B--B--B--B--B--B--B--B--
    H---H---H---H---H---H---
    (the triplet paradiddle with high-hat)