Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: How to compare an empty key with another empty key in associative array

by Rudolf (Pilgrim)
on Oct 24, 2012 at 11:50 UTC ( #1000615=note: print w/replies, xml ) Need Help??


in reply to How to compare an empty key with another empty key in associative array

$b = {}; is not an associative array. An array containing other arrays may look something like this:

my @two_d_array = ([$x,$y,$z],[1,2,3],['a','b','c']);

To see if an array is empty, you can check it's scalar value for contents.

my $elements = scalar(@two_d_array);

UPDATED: Associative array is considered a hash in Perl, (thanks choroba),

Replies are listed 'Best First'.
Re^2: How to compare an empty key with another empty key in associative array
by choroba (Bishop) on Oct 24, 2012 at 11:51 UTC
    "Associative array" is "hash" in Perl lingo, not an array.
    لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1000615]
help
Chatterbox?
[Discipulus]: so my 'less' usage sounded not so correct? 'fewer' was more appropriate? i take a note too
Discipulus $ENV{PAGER}='fewer '
[Corion]: Discipulus: Hahahaa! ;)
[Corion]: This would be a great April fools joke, since it certainly makes sense to show fewer pages on screen :)
[marioroy]: greetings all
[Corion]: Hi marioroy!
[Corion]: I'm slowly thinking that IP::CloudHoster is a bad name. The module started out as a module to identify whether an IP address comes from a cloud hoster like AWS (or Google GCE, or Linode), but now I also added ...
[Corion]: ... a way to verify that an IP is the GoogleBot crawler. Maybe I should rename it to IP::HostInformatio n or IP::ServiceInforma tion or something like that...
[Corion]: The main idea is to use this module in a web log analyzer to highlight (real) users and flag for example hammering from AWS or GoogleBot (or UAs claiming to be GoogleBot)

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (12)
As of 2018-01-23 09:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How did you see in the new year?










    Results (242 votes). Check out past polls.

    Notices?