Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Perl Beginners > Re: Writing sid...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 4 Topic 11029 of 11509
Post > Topic >>

Re: Writing side of square

by rob.dixon@[EMAIL PROTECTED] (Rob Dixon) May 5, 2008 at 03:33 PM

Rodrigo Tavares wrote:
> 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 @[EMAIL PROTECTED]
 = ();
> 
> $cont = 0;
> 
> while ($numero > $cont)
>  {
>  	$array[$cont]="*";
>  	$cont++;
>  }
>  
>  print @[EMAIL PROTECTED]
>  print "\n";
>  print @[EMAIL PROTECTED]
>  print "\n";

my @[EMAIL PROTECTED]
 = ('*' x $number) x $number;
substr $_, 1, $number-2, ' ' x ($number-2) for @[EMAIL PROTECTED]
 "\n\n";
print "$_\n" foreach @[EMAIL PROTECTED]

 




 4 Posts in Topic:
Writing side of square
digolinopage@[EMAIL PROTE  2008-05-05 06:22:51 
Re: Writing side of square
rob.dixon@[EMAIL PROTECTE  2008-05-05 15:33:03 
Re: Writing side of square
kratzers@[EMAIL PROTECTED  2008-05-05 11:18:08 
Re: Writing side of square
chas.owens@[EMAIL PROTECT  2008-05-05 17:18:13 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Jul 23 21:17:38 CDT 2008.