in reply to Printing a hollow square of Asterisks
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;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Printing a hollow square of Asterisks
by Rafter (Initiate) on Mar 04, 2009 at 18:56 UTC | |
by GrandFather (Saint) on Mar 04, 2009 at 22:57 UTC |