--- loncom/interface/loncommon.pm 2009/05/16 18:06:41 1.819 +++ loncom/interface/loncommon.pm 2009/05/18 16:08:07 1.820 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.819 2009/05/16 18:06:41 tempelho Exp $ +# $Id: loncommon.pm,v 1.820 2009/05/18 16:08:07 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -10212,6 +10212,22 @@ sub escape_url { return join('/',@urlslices).'/'.$lastitem; } +sub compare_arrays { + my ($arrayref1,$arrayref2) = @_; + my (@difference,%count); + @difference = (); + %count = (); + if ((ref($arrayref1) eq 'ARRAY') && (ref($arrayref2) eq 'ARRAY')) { + foreach my $element (@{$arrayref1}, @{$arrayref2}) { $count{$element}++; } + foreach my $element (keys(%count)) { + if ($count{$element} == 1) { + push(@difference,$element); + } + } + } + return @difference; +} + # -------------------------------------------------------- Initialize user login sub init_user_environment { my ($r, $username, $domain, $authhost, $form, $args) = @_;