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;