Title: RE: [Perl-unix-users] Index of array element
    You have it as an array, but if unique, then why not setup as hash and you would not have to do any searching, but would know right a way with just a simple test vs searching the whole array each time.
 
Wags ;)
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Jason Vincent
Sent: Wednesday, December 03, 2003 10:50
To: Craig Sharp; [EMAIL PROTECTED]
Subject: RE: [Perl-unix-users] Index of array element

@array = ('a','b','c');

for($i=0;$i<=$#array;$i++){
        print "index is $i\n" if $array[$i] eq 'b';
}

J


-----Original Message-----
From: Craig Sharp [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 03, 2003 10:00 AM
To: [EMAIL PROTECTED]
Subject: [Perl-unix-users] Index of array element


I have an array of names.  I need to find the corresponding index for a particular name.  How can I do this?

Thanks,

Craig
_______________________________________________
Perl-Unix-Users mailing list [EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs



**********************************************************
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.
****************************************************************

Reply via email to