maikelnight has asked for the wisdom of the Perl Monks concerning the following question:
Dear Monks, i have a construct which is more or less working (Dummy here, be kindly please).
%targets = ( '_source' => [], '_name'=> [] ); foreach my $ip1 (@ips){ foreach my $ref (@http){ for my $bla ( $ref->{'_source'}->{'clientip'} ) { if ($bla eq $ip1){ my $name = gethostbyaddr(inet_aton($bla), AF_INET); if ( $name !~ /.*\.dom1\.\.*.*./ ) { if ( $name !~ /.*\.dom2\.\.*.*./ ) { if ( $name !~ /.*\.dom3\.\.*.*./ ) { push @{ $targets{'_source'} }, $bla; push @{ $targets{'_name'} }, $name; } } } } } } }
What happens is that this code pushes all $bla to VAR1->_source and $name to VAR1->_name, like:
What i am trying to archive is to have a structure like:$VAR1 = { '_name' => [ 'carbon019.a.ahrefs.com', 'u17478488.onlinehome-server.com', ], '_source' => [ '181.167.186.3', '34.230.53.172', ] };
VAR1->_source->$bla _name->$name VAR2->_source->bla _name->$name
and so on....May i ask a monk to help? I tried some stuff, but it didnt work. Thanks!!!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Push to Reference
by haukex (Archbishop) on Oct 10, 2017 at 09:40 UTC | |
|
Re: Push to Reference
by VinsWorldcom (Prior) on Oct 10, 2017 at 11:07 UTC |