in reply to Matching arrays
Note that there are some interesting points on array manipulations like this in perlfaq4.use strict; my @subarray=qw(1 2 3); my @array1=qw(1 2 3 4 5 6); my @array2=qw(2 3 4 5 6); print contains(\@subarray, \@array1)?"Yes":"No"; print "\n"; print contains(\@subarray, \@array2)?"Yes":"No"; sub contains { my $array=shift; my $container=shift; my %container=map { $_ => undef } @$container; foreach (@$array) { return 0 unless (exists $container{$_}); } return 1; } __END__ Yes No
CU
Robartes-
|
|---|