@b = (ab, c); #### @a = (a, bc, d); #### sub isOrderedSublist{ my ( $aref, $bref ) = @_; # references to arrays my @a = @$aref; # major - copy so we can safely destroy my @b = @$bref; # minor my $firstMatched = 0; while( not Empty( \@a ) ) { if ( $a[0] eq $b[0] ) { $firstMatched = 1; shift @b; else { $firstMatched and last; } shift @a; } return Empty( \@b ); # success if failure eliminated } sub Empty{ my $aref = shift; return( not ( $#$aref + 1 ) ); }