>>>>> "HP" == Harry Putnam <rea...@newsguy.com> writes:
HP> "John W. Krahn" <jwkr...@shaw.ca> writes: >>> I need to do some matching of filenames in two top level directories. >>> We expect to find a number of cases where the endnames ($_) are the >>> same in both hierarchies but the full name is different. >>> >>> base1/my/file >>> base2/my/different_path/file HP> This should have been clarified better as Uri has noted... HP> The match was to be the part in brackets against the other part in HP> brackets below: if you refer to my notes, then use the proper name. showing stuff in brackets isn't teaching you anything. HP> base2/my/different_path/[file] HP> base1/my/[file] HP> so the hashes were to have these pairs: HP> for base2: HP> file => base2/my/different_path/file HP> or: ($_) => ($File::Find::name) HP> for base1: HP> file => base1/my/file HP> or: ($_) => ($File::Find::name) again, why the poor names? what is 'base'? how is 1 different than 2? you have yet to properly specify the PROBLEM. you keep talking about solutions. as i said, comparing dir trees can be done many different ways and you have yet to say what your goal is. do that clearly before you write another line of code. you may think you know it but i disagree as you haven't articulated it yet. when you do, the coding will be much easier for you and us. also you will get proper names finally. stop using generic names!! might as well use basic and $a1, $a2. names have meaning so put some meaning into them. HP> And the matching would be HP> each $value from base1 hash matched against HP> all $values from base2 hash. HP> Where a match occurs... extract that value from base2 again, why would i know which is base1 vs base2? why would i care? HP> I see the way you did it, even though not the exact results I was HP> after is 100s of percent better way to write it. see, even coding help doesn't work for you since you haven't a properly written up goal. stick to english first, then perl. this is a good rule for algorithm stuff like this. HP> I'm curious though if the overhead is different in your compact code HP> compared to mine. That is, if all that spinning through dir2: get it right first, then optimize. uri -- Uri Guttman ------ u...@stemsystems.com -------- http://www.sysarch.com -- ----- Perl Code Review , Architecture, Development, Training, Support ------ --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com --------- -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/