develooper Front page | perl.beginners | Postings from May 2008

Writing side of square

Thread Next
From:
Rodrigo Tavares
Date:
May 5, 2008 06:23
Subject:
Writing side of square
Hello,

I need create a square using a single number, but I don't know how to create the sides.

I have to create this:

****
*  *
*  * 
****

My code is below :

print "Enter with number:";
chomp ($number = <STDIN>);

my @array = ();

$cont = 0;

while ($numero > $cont)
 {
 	$array[$cont]="*";
 	$cont++;
 }
 
 print @array;
 print "\n";
 print @array;
 print "\n";
  
How I can to show the arrar like sides ?

[]'s

Faria


      Abra sua conta no Yahoo! Mail, o único sem limite de espaço para armazenamento!
http://br.mail.yahoo.com/

Thread Next


Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About