in reply to Re^4: Printing a hollow square of Asterisks
in thread Printing a hollow square of Asterisks

possible mis-use of single-quoting if you are on W32? Or, try:

#!/usr/bin/perl -l use strict; use warnings; my $n = shift; # assign the number provided as an argue +ment to $n die q{Please provide a positive number.} if ($n < 0); # not negative print q{*} x $n; # print "*" $n times followed by newline +(the shebang's -l switch if ($n >1) { foreach (2 .. $n - 1) { # print second line .. next +to last line print q{*}, q{ } x ($n - 2), q{*}; # with $n-2 spaces (first & +last postions are * } print "*" x $n ; }

Tested on *nix and W2k