Loading...
 

Perl Code to Remove Dups in Array

sub uniq {
    my %seen;
    grep !$seen{$_}++, @_;
}



#
    @title = split ("," , $TITLE{$a}) ;
	@titles=uniq(@title);
    foreach $ttl (@titles){
        print "title: $ttl\n" ;
    }
#


#
    @dept = split ("," , $DEPT{$a}) ;
        @depts=uniq(@dept);
        @ous = ();
    foreach $dpt (@depts){
           print "departmentNumber: $dpt\n" ;
        if ($DESC{$dpt}) {
                push(@ous,$DESC{$dpt}) ;
        }

    }
        @ou=uniq(@ous);
        foreach $oun (@ou){
                print "ou: $oun\n" ;
        }
#