in reply to Printing a hollow square of Asterisks

Homework?
my $x = 4; my $y = 4; for my $xx (1..$x) { for my $yy(1..$y) { if( something ){ print ' '; } else { print "*"; } } print "\n"; }

Replies are listed 'Best First'.
Re^2: Printing a hollow square of Asterisks
by Anonymous Monk on Mar 04, 2009 at 14:31 UTC
    this code doesnt output anything??

      Maybe you thought the something in

      if( something ){
      was an actual instruction or variable?

      If so, use strict; use warnings; would have disabused you of that notion.

      Yes it does.
      $ perl test.pl |od -ta 0000000 sp sp sp sp nl sp sp sp sp nl sp sp sp sp nl s +p 0000020 sp sp sp nl 0000024 $ perl test.pl |od -tx1 0000000 20 20 20 20 0a 20 20 20 20 0a 20 20 20 20 0a 20 0000020 20 20 20 0a 0000024 $
      You're supposed to replace something with a simple expression that evaluates to true when you want to print spaces.