# Define the two planets my @large= ($red, 200,200,50,50 ); my @small= ($green, $xc, $yc, 25, 25 ); my( $front, $back ); if( $red_is_in_front_of_green ) { $front= \@large; $back= \@small; } else { $front= \@small; $back= \@large; }; # Just in case we ever go beyond two objects my @objects_to_draw= ($back, $front); for my $item (@objects_to_draw) { my( $color, @position )= @$item; $ima->filledEllipse( @position, $color ); };