Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: writing report using format

by eff_i_g (Curate)
on Jan 18, 2011 at 04:52 UTC ( #882811=note: print w/replies, xml ) Need Help??

in reply to writing report using format

Have you gandered at perlform? Or Text::Reform? printf is an option as well.

Replies are listed 'Best First'.
Re^2: writing report using format
by rocky13 (Acolyte) on Jan 18, 2011 at 10:19 UTC

    I have looked at perlform and I will look at the other two. My main problem is how do I incorporate my print results from the main code into the "format" portion of the code? In other words, how do i get my results to actually print under the indicated format? Thanks.

      Here is an example you might find useful:

      use strict; use warnings; # Formats my ($crt, $text, $num); format = @< @<<<<<<<< @###.## $crt, $text, $num . format STDOUT_TOP = @||||||||||||||||||||| "Example Format" ---------------------- Nr Text Number -- -------- -------- . my $total = 0; format RAPORT_TOTAL = ---------------------- @###.## $total ---------------------- . # End formats while (<DATA>) { s /[\n|\r]//g; # clean ($crt, $text, $num) = split(/;/, $_, 3); $total += $num; write(); } # Change format $~ = "RAPORT_TOTAL"; write(); __DATA__ 1;some data;123.34 2;other;432.54 3;testing;123.55

      Regards, Stefan

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://882811]
marioroy just logged in to say that MCE::Hobo has passed testing and therefore will continue to run like threads but have managed capabilities similar to Parallel:: ForkManager. It allows multiple managed instances to run simultaneously. Zero limitations.
marioroy it's taken a long time to make this possible.
marioroy will post demonstrations after release

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2017-07-28 19:42 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (433 votes). Check out past polls.