<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">package Math_Set;

$VERSION="1.00";

sub minimal
{
  my ($array) = @_; # Pass by reference 
  my $i=0;
  my $j;
  
  while ( $i &lt; $#{$array} )
  {
    $j = $i+1;
    while ( $j &lt;= $#{$array} )
    {
      #print "\${\$array[$i] = ${$array}[$i] \n";
      #print "\${\$array[$j] = ${$array}[$j] \n";
      #print "len(array) = " . scalar(@{$array}) . "\n";
      if ( ${$array}[$i] eq ${$array}[$j] )
      {
        # Remove j element 
        #print "Removed $j element\n";
        splice @{$array} , $j, 1;
        # Decrement j since we just removed an element 
        # and it will be incremented again at the end of the while 
        $j--;
      }
      $j++;
    }
    $i++;
  }

}#end minimal_set

return 1;
</pre></body></html>