in reply to Looping through arrays : are they equal ?

YAADA (yet another another Dumper approach)
#!perl use strict ; use warnings ; use Data::Dumper; my $refcomp= { 'Ad1' => [ '0A78', '0A9E', '0AB9', '0AC0', ], 'Ad2' => [ '0A78', '0A9E', '0AB9', '0AC0', + ] }; # sort the arrays if not already all in order if ( "sort needed" eq "sort needed" ) { while ( my ( $k, $v ) = each %$refcomp ) { $refcomp -> { $k } = \( sort @$v ); } } # the test my $lastref = ''; for my $curref ( values %$refcomp ) if ( $lastref ) { Dumper( $lastref ) eq Dumper( $curref ) or die "non-unique device list detected"; } $lastref = $curref; }
Update: if the sort is needed the test can be moved into the while loop that does the sort and the final for loop removed.

One world, one people

Replies are listed 'Best First'.
Re^2: Looping through arrays : are they equal ?
by ZlR (Chaplain) on Apr 23, 2011 at 13:15 UTC
    that's way over my head for now, but thanks !!