Re: sort and count match in file

2012-04-16 Thread Uri Guttman
On 04/16/2012 01:58 AM, Shekar wrote: if( exists $hash_val{$dom} ) { my $val=$hash_val{$dom}; $val++; $hash_val{$dom}=$val; } else { $hash_val{$dom}=1; } all that code can be replaced with this one line: $hash_val{$dom}++ ;

Re: sort and count match in file

2012-04-16 Thread Dr.Ruud
On 2012-04-16 07:58, Shekar wrote: next if (/^\s$/); You probably meant: next if /^\s*$/; # skip blank lines -- Ruud -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: sort and count match in file

2012-04-16 Thread Shekar
Thanks Uri, and Ruud for lightening up :) Cheers, Shekar On Mon, Apr 16, 2012 at 12:25 PM, Dr.Ruud rvtol+use...@isolution.nl wrote: On 2012-04-16 07:58, Shekar wrote: next if (/^\s$/); You probably meant: next if /^\s*$/; # skip blank lines -- Ruud -- To unsubscribe,

Re: sort and count match in file

2012-04-16 Thread Rob Dixon
On 15/04/2012 18:44, Вячеслав Агапов wrote: Hello all. I have a file with logs 2012-04-13 17:06:10,881 test:dom1 CRIT home 2012-04-13 17:06:10,882 work:dom1 CRIT home 2012-04-13 17:06:10,882 my:dom1 CRIT home 2012-04-13 17:06:10,881 test:dom2 CRIT home 2012-04-13 17:06:10,882 work:dom2 CRIT

and subroutine

2012-04-16 Thread Paul.G
Hi All Have a question, is it good coding practice to use a when calling a subroutine, or it is not required, or it doesn't matter? eg: sub name { some code here, returning a single value return 0; } name(); cheers

Re: and subroutine

2012-04-16 Thread Paul Johnson
On Mon, Apr 16, 2012 at 06:53:53AM -0700, Paul.G wrote: Hi All Have a question, is it good coding practice to use a when calling a subroutine, or it is not required, or it doesn't matter? It's good practice not to use it unless you understand exactly why you would need to use it. -- Paul