I have started a code that prints one row, but can't get that to work even. The first row should represent 1-9, the second row 10-90 and the third 100-900.

#!/usr/bin/perl

# a program to simulate a one-row playpen abacus

$abacus = "UUUUUUUUUU "; # I put a space at the end. See below
while (1){
print "\n$abacus\n? ";
# pick up the string
$us = <STDIN>;
# convert string to array
@us = split //, $us;
for $i (@us){ # for each item in array
if ($i eq 'U'){
$abacus =~ s/U / U/;# move space to left
}
}
}