Tough to beat JavaFan's, but here's a fairly plain-English method:
use strict; use warnings; my $x = 4; # width my $y = 2; # number of "hollow" rows my $solid = '*' x $x . $/; my $hollow = '*' . ' ' x ($x-2) . '*' . $/; print $solid, ($hollow) x $y, $solid;
In reply to Re: Printing a hollow square of Asterisks
by hbm
in thread Printing a hollow square of Asterisks
by Rafter
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |