Rodrigo Tavares <[EMAIL PROTECTED]> asked:
> I need create a square using a single number, but I don't 
> know how to create the sides.

#!/usr/bin/perl -w

use strict;

for( my $n = 1 ; $n <= 10; $n++ ){

  print "\nn = $n\n\n";

  if( $n == 1 ){
    print "*\n";
  } else {
    print '*'x$n . "\n";
    for( my $line = 2; $line < $n; $line ++ ){
      print '*' . ' 'x($n-2) . "*\n";
    }
    print '*'x$n . "\n";
  }

}

__END__

HTH,
Thomas

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to