Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^3: writing report using format

by stefbv (Deacon)
on Jan 18, 2011 at 11:41 UTC ( #882854=note: print w/replies, xml ) Need Help??


in reply to Re^2: writing report using format
in thread writing report using format

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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://882854]
help
Chatterbox?
[Eily]: there should be an option in grep for fuzzy order of the letters in the pattern
[Eily]: as in "I might have inverted two, but my eyes misread in the some order as my fingers mistype"
[LanX]: can't find a definition for the sound
[LanX]: Voiceless_palatal_ fricative
[Eily]: Lanx https://en. wikipedia.org/ wiki/Voiceless_pal atal_fricative
Eily got the Cowboy message
[Your Mother]: I prefer palatial fricatives.
[Lotus1]: https://en. wikipedia.org/ wiki/%C3%87
[Your Mother]: I'm headed out west, sucker.

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (16)
As of 2017-03-27 17:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (320 votes). Check out past polls.