my $pos = 3; my $i; foreach $i (1..5) { print( ("*"," ","|")[ $i <=> $pos ], " $i\n"); };