Pretty output question

Posted by sid_com on Stack Overflow See other posts from Stack Overflow or by sid_com
Published on 2010-03-20T08:20:25Z Indexed on 2010/03/20 8:31 UTC
Read the original article Hit count: 398

Filed under:
|

Hello!

 #!/usr/bin/env perl
 use warnings; 
 use strict;

 my $text = 'hello ' x 30;

 printf "%-20s : %s\n", 'very important text', $text;

the output of this script looks more ore less like this:

very important text      : hello hello hello  hello   
hello hello hello hello hello hello hello hello  
hello hello hello hello hello hello hello hello  
...   

but I would like an output like this:

very important text: hello hello hello hello  
                     hello hello hello hello  
                     hello hello hello hello  
                     ... 

How could I change my script to reach my goal?

© Stack Overflow or respective owner

Related posts about perl

Related posts about printf