CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
how to check if a number doesn't exist in a hash

 



cliffyiu
Novice

May 1, 2012, 8:18 AM

Post #1 of 2 (783 views)
how to check if a number doesn't exist in a hash Can't Post

Hi,

I know I can use exists $hash{$key} to check if a key is in a hash. I am wondering if there is a function which can be used to check if a key is NOT in a hash, for example, something like not_exists $hash{$key}.

Please advise.

-C


FishMonger
Veteran / Moderator

May 1, 2012, 8:49 AM

Post #2 of 2 (768 views)
Re: [cliffyiu] how to check if a number doesn't exist in a hash [In reply to] Can't Post


Code
if ( ! exists $hash{$key} ) {

or

Code
if ( not exists $hash{$key} ) {


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives