correct way to check for empty hash

Discussion in 'Perl Misc' started by justme, Oct 9, 2004.

  1. justme

    justme Guest

    hi

    in the perldoc, the way to check for a hash with members is

    if ( %hash )
    {
    print "has elements";
    }

    but what is the correct way to check for empty hash?

    Which is the correct way
    1) if (!%hash ) or
    2) if (%hash < 1)


    or other methods??
    thanks...
    justme, Oct 9, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. joon
    Replies:
    1
    Views:
    515
    Roedy Green
    Jul 8, 2003
  2. Marcia Hon

    Check if a directory is empty and empty it

    Marcia Hon, Feb 8, 2004, in forum: C Programming
    Replies:
    8
    Views:
    573
    Dave Thompson
    Feb 14, 2004
  3. rp
    Replies:
    1
    Views:
    516
    red floyd
    Nov 10, 2011
  4. Siratinee Sukachai
    Replies:
    1
    Views:
    141
    7stud --
    Apr 22, 2011
  5. froil
    Replies:
    12
    Views:
    310
    Gunnar Hjalmarsson
    Mar 2, 2006
Loading...

Share This Page