Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Problems with tabulations

Reply
Thread Tools

Problems with tabulations

 
 
Luca Francesca
Guest
Posts: n/a
 
      11-06-2012
Hello.
I've a program to extract some data from a file. ( http://pastebin.com/f3M6LuQw ).
The output of the program is not nice as i want (I used \t but isn't working well)

Any idea about a fix??

Thanks an good day all.

Luca
 
Reply With Quote
 
 
 
 
J. Gleixner
Guest
Posts: n/a
 
      11-06-2012
On 11/06/12 15:30, Luca Francesca wrote:
> Hello.
> I've a program to extract some data from a file. ( http://pastebin.com/f3M6LuQw ).
> The output of the program is not nice as i want (I used \t but isn't working well)
>
> Any idea about a fix??



Pretty poor code.. but to answer your question.. modify the outout
produced by 'print' as needed.. e.g. use printf instead of relying on
tab.

e.g. this line:

print "Service \t $service \n";

might produce nicer output as

printf "%-15s %s\n", 'Service', $service;

For other options and to explain what the '-' does, see:
perldoc -f sprintf
 
Reply With Quote
 
 
 
 
Luca Francesca
Guest
Posts: n/a
 
      11-07-2012
Il giorno martedý 6 novembre 2012 22:47:35 UTC+1, J. Gleixner ha scritto:
> On 11/06/12 15:30, Luca Francesca wrote:
>
> > Hello.

>
> > I've a program to extract some data from a file. ( http://pastebin.com/f3M6LuQw ).

>
> > The output of the program is not nice as i want (I used \t but isn't working well)

>
> >

>
> > Any idea about a fix??

>
>
>
>
>
> Pretty poor code.. but to answer your question.. modify the outout
>
> produced by 'print' as needed.. e.g. use printf instead of relying on
>
> tab.
>
>
>
> e.g. this line:
>
>
>
> print "Service \t $service \n";
>
>
>
> might produce nicer output as
>
>
>
> printf "%-15s %s\n", 'Service', $service;
>
>
>
> For other options and to explain what the '-' does, see:
>
> perldoc -f sprintf


Nice fix.
Thanks.
 
Reply With Quote
 
Luca Francesca
Guest
Posts: n/a
 
      11-07-2012
Il giorno mercoledý 7 novembre 2012 00:33:04 UTC+1, Ben Morrow ha scritto:
> Quoth "J. Gleixner" <(E-Mail Removed)>:
>
> > On 11/06/12 15:30, Luca Francesca wrote:

>
> > > Hello.

>
> > > I've a program to extract some data from a file. (

>
> > http://pastebin.com/f3M6LuQw ).

>
> > > The output of the program is not nice as i want (I used \t but isn't

>
> > working well)

>
> > >

>
> > > Any idea about a fix??

>
> >

>
> >

>
> > Pretty poor code.. but to answer your question.. modify the outout

>
> > produced by 'print' as needed.. e.g. use printf instead of relying on

>
> > tab.

>
> >

>
> > e.g. this line:

>
> >

>
> > print "Service \t $service \n";

>
> >

>
> > might produce nicer output as

>
> >

>
> > printf "%-15s %s\n", 'Service', $service;

>
>
>
> If you're producing formatted ASCII output, you might consider using
>
> formats.
>
>
>
> <duck>
>
>
>
> (Or Perl6::Form, which is nicer and saner, and not really Perl-6-related
>
> at all.)
>
>
>
> Ben


I'll give it a shot
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Saving the web, charset problems and symbols problems Sak Na rede Ruby 0 01-30-2009 05:05 AM
Problems, problems for newbie Shelly ASP .Net 1 09-03-2007 02:10 AM
Problems compiling simple C++ code (also problems with std::string) Susan Baker C++ 2 06-26-2005 01:43 AM
Re: sound problems and modem problems Harold Potter Computer Support 5 12-04-2003 04:12 PM



Advertisments