in reply to any idea how push (@$user,"$ent_date\t$message\t$firewall\t$service");

That code, which I understand isn't yours, is pretty funky. It creates a named array through a symbolic reference for each distinct $user you see. It would be much cleaner and better to use a hash.

That whole chunk of code can be replaced with:

push @{$control_hash{$user}}, "$ent_date\t$message\t$firewall\t$service";
The existence of a user can be tested with exists $control_hash{$user}.

After Compline,
Zaxo

  • Comment on Re: any idea how push (@$user,"$ent_date\t$message\t$firewall\t$service");
  • Download Code

Replies are listed 'Best First'.
Re^2: any idea how push (@$user,"$ent_date\t$message\t$firewall\t$service");
by ysth (Canon) on Jun 05, 2007 at 08:16 UTC
    Not necessarily a symbolic reference; it could be an overloaded object.

    The hash discards order, which may be important.

Re^2: any idea how push (@$user,"$ent_date\t$message\t$firewall\t$service");
by grep (Monsignor) on Jun 07, 2007 at 16:31 UTC
    Unless I'm missing something - it doesn't have to be an overloaded obj or a symbolic ref. It could be just a non-explicit (DWIM) deref.
    use strict; use warnings; use Data::Dumper; my $user = [ 'foo','bar' ]; push( @$user,'baz'); print Dumper $user;

    grep
    1)Gain XP 2)??? 3)Profit