Centering Output in Perl

I need help centering my output in perl

Page 1 of 1

3 Replies - 4994 Views - Last Post: 23 October 2007 - 01:10 PM

#1 killkenny55   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 01-June 07

Centering Output in Perl

Posted 22 October 2007 - 05:04 PM

I am trying to center the output of my code into the center of the console im a complete beginner at perl and do not know how to center it. could anyone please help.

thanks in advance.
Is This A Good Question/Topic? 0
  • +

Replies To: Centering Output in Perl

#2 girasquid   User is offline

  • Barbarbar
  • member icon

Reputation: 108
  • View blog
  • Posts: 1,825
  • Joined: 03-October 06

Re: Centering Output in Perl

Posted 23 October 2007 - 09:17 AM

There isn't really a way to 'center' it that I know of...but you could try using tabs to move it over. Just put \t into your output to add a tab.
Was This Post Helpful? 0
  • +
  • -

#3 no2pencil   User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6659
  • View blog
  • Posts: 30,976
  • Joined: 10-May 07

Re: Centering Output in Perl

Posted 23 October 2007 - 09:56 AM

View Postkillkenny55, on 22 Oct, 2007 - 05:04 PM, said:

I am trying to center the output of my code into the center of the console im a complete beginner at perl and do not know how to center it. could anyone please help.

thanks in advance.

Count your characters, minus that value from your defined output length (say 80 ish?) & then divide that by two. Run a for loop to print a space that many times before & after your output.

Wah-lah, centered output!
Was This Post Helpful? 0
  • +
  • -

#4 killkenny55   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 01-June 07

Re: Centering Output in Perl

Posted 23 October 2007 - 01:10 PM

thanks for the advice ill use it
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1