#! /usr/bin/perl -w

use strict;

my %hash = ('a1', '2', '3', '4');
my @arr = %hash;
print $arr[0];       

Here you can get the actual sequence of keys in ur hash by printing all the
even indexe elements of the array

> ----------
> From:         Sudarshan Raghavan[SMTP:[EMAIL PROTECTED]
> Sent:         Thursday, June 12, 2003 6:09 PM
> To:   [EMAIL PROTECTED]
> Subject:      Re: Returning the first key in a hash...
> 
> 
> 
> Hamish Whittal wrote:
> 
> >Hi all,
> >
> >I have a hash and want to return the first key in the hash. How can I do
> >this?
> >
> 
> The answer is (keys (%your_hash))[0]. This will return the first element 
> in the list of hash keys returned by keys. But, you can never be sure of 
> the order in which the keys will be retrieved. If you are worried about 
> the order, take a look at the Tie::IxHash module.
> 
> >
> >Thanks in advance,
> >
> >Hamish
> >
> >
> >  
> >
> 
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
____________________________________________
Confidential:  This electronic message and all contents contain information
from Syntel, Inc. which may be privileged, confidential or otherwise
protected from disclosure. The information is intended to be for the
addressee only. If you are not the addressee, any disclosure, copy,
distribution or use of the contents of this message is prohibited.  If you
have received this electronic message in error, please notify the sender
immediately and destroy the original message and all copies.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to