Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Searching a string array

Status
Not open for further replies.

JJ1

Programmer
Apr 19, 2001
104
GB
Hi All,

This is probably a very simple question, but what is the best way to search an array in perl, while ignoring CASE? I thought this:
[red]
#If oncallname is in the secondline array, put it in the hash table
foreach $x (@secondline){
if( ( (lc($oncallname)) eq (lc($x) ) ){
$oncall->{"SecondLine", $oncallName};
}
}
[/red]


The other thing I need to know is whether I can store more than one value under a hash key and how this would be recalled? My guess was:
[red]
print $q->Tr( $q->td($q->b($OnCallPeople->"Second Line")),

$q->td( $oncallSumStyle, "Second Line: ", values(%oncall->{Second Line}))

);
[/red]

I know these must be very 'newbie' questions, but if someone could help, I'd very much appreciate it.

Thanks,

James.
 
James,

Have a look at one of the hashes FAQ's, it describes how to have an array or hash of hashes. Mike
________________________________________________________________

"Experience is the comb that Nature gives us, after we are bald."

Is that a haiku?
I never could get the hang
of writing those things.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top