icon Top 9 categories map      RocketAware > Perl >

exists EXPR

Tips: Browse or Search all pages for efficient awareness of Perl functions, operators, and FAQs.


Search Perl pages


By activity
Professions, Sciences, Humanities, Business, ...

User Interface
Text-based, GUI, Audio, Video, Keyboards, Mouse, Images,...

Text Strings
Conversions, tests, processing, manipulation,...

Integer, Floating point, Matrix, Statistics, Boolean, ...

Algorithms, Memory, Process control, Debugging, ...

Stored Data
Data storage, Integrity, Encryption, Compression, ...

Networks, protocols, Interprocess, Remote, Client Server, ...

Hard World
Timing, Calendar and Clock, Audio, Video, Printer, Controls...

File System
Management, Filtering, File & Directory access, Viewers, ...

exists EXPR
Returns TRUE if the specified hash key exists in its hash array, even if the corresponding value is undefined.

    print "Exists\n" if exists $array{$key};
    print "Defined\n" if defined $array{$key};
    print "True\n" if $array{$key};

A hash element can be TRUE only if it's defined, and defined if it exists, but the reverse doesn't necessarily hold true.

Note that the EXPR can be arbitrarily complicated as long as the final operation is a hash key lookup:

    if (exists $ref->[$x][$y]{$key}) { ... }

Source: Perl builtin functions
Copyright: Larry Wall, et al.
Next: exit EXPR

Previous: exec LIST

(Corrections, notes, and links courtesy of RocketAware.com)

[Overview Topics]

Up to: Locating Data
Up to: Data structures (In memory)

Rapid-Links: Search | About | Comments | Submit Path: RocketAware > Perl > perlfunc/exists.htm
RocketAware.com is a service of Mib Software
Copyright 2000, Forrest J. Cavalier III. All Rights Reserved.
We welcome submissions and comments