[Roma.pm] saluti e piccola domanda :)
LordOfDeath
webmaster.staff at gmail.com
Tue Apr 17 11:56:08 PDT 2007
Marco Balestra ha scritto:
> On 17/apr/07, at 19:48, LordOfDeath wrote:
>
>
>>> ad ogni occorrenza setto $hash{$chiave}++, alla fine ho sia
>>> l'elenco senza ripetizioni (keys %hash) che le numerosità di ogni
>>> singola occorrenza.
>>>
>> potresti farmi un esempio per favore? grazie in anticipo
>>
>
> my @procs = `ps aux`;
> my %PS;
> foreach my $line (@procs){
> chomp $line;
> $line =~ s/ [0-9].+$//;
> $line =~ s/USER.+COMMAND//;
> $PS{$line}++ if $line;
> }
>
> A questo punto puoi usare %PS, ad esempio:
>
> foreach my $k (sort keys %PS) {
> print "$k is here $PS{$k} times\n";
> }
>
grazie mille :) e grazie a tutti quelli che mi hanno aiutato :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/roma/attachments/20070417/cf7715ca/attachment.html
More information about the Roma
mailing list