in reply to Re^6: Queries for elastic search using perl
in thread Queries for elastic search using perl
No, the size should be 2 because your hash has 2 elements: a key and a value. The hash is expanded into a list when pushed onto an array so the array has 2 new values, the first being the key and the second being the value. eg:
#!/usr/bin/env perl use strict; use warnings; use Test::More tests => 1; my %z = ( a => 'b' ); my @x = ( 'a', 'b' ); my @y = (); push @y, %z; is_deeply (\@x, \@y);
If you don't want the hash expanded in this way then you must use a reference to it instead when you push it. The reference is then just one element in the resulting array. It will probably help you greatly to have a thorough read of perldsc.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^8: Queries for elastic search using perl
by ravi45722 (Pilgrim) on Jun 29, 2016 at 12:32 UTC |