Re: fun with hashes!

2007-11-25 Thread John Douglas Porter
Uri wrote: isa is a key valid? (not same as in a set). isa usually works on fixed sets of keys Well, in a strict sense it IS the same, as it is just one of many possible set operations. I suppose you could say it's a subset of sets. :-) I think you're trying to focus on the

Re: fun with hashes!

2007-11-25 Thread Uri Guttman
JDP == John Douglas Porter [EMAIL PROTECTED] writes: JDP Uri wrote: isa is a key valid? (not same as in a set). isa usually works on fixed sets of keys JDP Well, in a strict sense it IS the same, as it is just one JDP of many possible set operations. I suppose you could say

Re: fun with hashes!

2007-11-25 Thread Keith Ivey
Jerrad Pierce wrote: How about using a hash to keep track of which things you've already handled? That's just the afore-mentioned count True, I guess, but lots of these uses are the same. In Uri's original post, isa could be considered the same as sets, and records the same as data

Re: fun with hashes!

2007-11-25 Thread Brian Duggan
Don't know if this falls into categories already covered (set of active objects in a class? counting?), but I often find a hash of open filehandles useful. e.g. to divide a big file into several smaller ones, using the distinct values of one of the fields as filenames : perl -MIO::File -ane

Re: fun with hashes!

2007-11-25 Thread Uri Guttman
s == shmem [EMAIL PROTECTED] writes: s You forgot an obscure corner of hashes: hashes in scalar context. s Here's a a use - calculate the next power of 2 of a given number: s sub next_power_of_two { s my %s; s @s{1..shift} = (); s %s =~ '/'; s return $'; s }

Re: fun with hashes!

2007-11-25 Thread Uri Guttman
KI == Keith Ivey [EMAIL PROTECTED] writes: KI Jerrad Pierce wrote: How about using a hash to keep track of which things you've already handled? That's just the afore-mentioned count KI True, I guess, but lots of these uses are the same. In Uri's original KI post, isa could be

Re: fun with hashes!

2007-11-25 Thread John Douglas Porter
Uri wrote: i still think isa is a (sic) concept that is important enough to cover on its own. sure it is a set but a very specific type with its own name. the names of these concepts are important (almost like design patterns which i despise :). If names are that important to you, then you