Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: How can we compare two hashed with each other for case insensitive data?

by wind (Priest)
on Jun 29, 2011 at 22:23 UTC ( #912055=note: print w/replies, xml ) Need Help??


in reply to How can we compare two hashed with each other for case insensitive data?

If case really doesn't matter, then the best solution is to just initialize the values with lc.

However, you can also set the values to lc after the fact as well:

lcvalues(@array1); lcvalues(@array2); sub lcvalues { for (@_) { if (ref $_ eq 'HASH') { lcvalues(values %$_); } elsif (ref $_ eq 'ARRAY') { lcvalues(@$_); } elsif (ref $_) { warn "Unknown data type: " . ref $_; } else { $_ = lc $_; } } }
  • Comment on Re: How can we compare two hashed with each other for case insensitive data?
  • Download Code

Replies are listed 'Best First'.
Re^2: How can we compare two hashed with each other for case insensitive data?
by dipesh777 (Novice) on Jun 30, 2011 at 02:32 UTC
    yes it worked! Thanks

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://912055]
help
Chatterbox?
[erix]: heh, you can record your tunes now, I hadn't seen that before
[erix]: and my solfège is a little rusty too
[stonecolddevin]: damn where's a working cblast? looks like several of them are out of commission
[erix]: Tanktalus home node has one

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (10)
As of 2017-06-22 20:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (529 votes). Check out past polls.