Harry Putnam wrote: > > "Charles K. Clarkson" <[EMAIL PROTECTED]> writes: > > > Harry Putnam said: > > : > > : Here is the problem: > > : > > : Summary run home made tools against only the > > : uniq paths that might contain perl *.pm files. > > > > Harry, that doesn't' make a bit of sense. > > Could you rephrase the question? > > You can say that again... Must be heavy senior moments today. > Not counting the misfired unfinished post that started the thread. > Its still just plain wrong through and through. > SPENCERS straightened me out. > > Having shot myself in the foot from the gate, I guess I might as > well reveal the true depths of my ignorance and ask a remaining > question. > > There were also typos in my initial post. I meant `*.pod' instead of > `*.pm' but that doesn't really change the required coding. > > I've butched the hell out of SPENCER's code in an attempte to get > sorted output (sort on non-absolute *.pod) and am getting duplicates > in the output. Probably some really unorthodox technique (or lack > there of). I often find that I code like an illiterate hillbilly. > Probably because that is what I am.... anyway: > > I stuck the little uniquifier gimmick in there to prevent dups but > can't really see why I would be getting dups. Maybe @INC does need > further processing > > What is causing duplicates in the output. Not everthing but only a > few. (The debug file, ./debug will have a number of dups in it) > > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > #!/usr/local/bin/perl -w > > use strict; > my (%name, @sorted, @unsorted, $absolute ); > use File::Find ; > > open(DBG,">./debug") or die "cannot open DBG: $!"; > > find(\&wanted,@INC); > > sub wanted { > if (/\.pod$/){ > print DBG "$File::Find::name\n"; > > if ($name{$File::Find::name}++ == 0){
The initial value in $name{$File::Find::name} will be undef not zero so comparing it to zero will not work. if ( $name{ $File::Find::name }++ ) { > push @unsorted, "$_ $File::Find::name"; You are using a space character as field separator however file and directory names can have spaces in them. > } > } > } > @sorted = sort @unsorted; You probably should use the keys of %name which are unique. my @sorted = sort keys %name; > for(@sorted){ > $absolute = (split(/ /,$_))[1]; > print "$absolute\n"; > } > close(DBG); John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]