Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions


WDVL Newsletter

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us















Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


Using the keys and values functions

Using the keys and values functions

  • Perl also provides a convenient way to get a list of all the keys or of all the values in an associative array if you are interested in more than just one key/value pair. Keys and values are accessed with the keys and values functions using the following formats:

    @associative_array_keys = 
    keys (%ASSOCIATIVE_ARRAY_NAME); 
    

  • and

    @associative_array_values = 
    values (%ASSOCIATIVE_ARRAY_NAME); 
    

  • Thus, the keys and values list of the associative array %CLIENT_ARRAY defined above can be generated with the following syntax:

    @client_array_keys = keys (%CLIENT_ARRAY); 
    @client_array_values = values (%CLIENT_ARRAY); 
    

  • In this example @client_array_keys would look like ("full_name", "phone", "age") and @client_array_values would look like ("Selena Sol", "213-456-7890", "27").

Additional Resources:

Accessing an Associative Array
Table of Contents
Adding to and deleting from an associative array


Up to => Home / Authoring / Scripting / Tutorial




Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers