Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

I have replaced the 'TOTAL' with a more "speaking" label. Pls look at the 'all...' rows and how they represent the sums of the (random) data in each of the blocks:

use strict; use warnings; use Data::Dumper; my %pivot; # generate 100 random records for app(lications) being accessed thru s +ome dev(ices) with some bro(wsers) for(1..100){ my($app,$dev,$bro) = (qw(App1 App2 App3)[rand 3],qw(Dev1 Dev2 Dev3 +)[rand 3],qw(Bro1 Bro2 Bro3)[rand 3]); ++$pivot{$app}{$dev}{$bro}; ++$pivot{'allapps'}{$dev}{$bro}; ++$pivot{$app}{'alldevs'}{$bro}; ++$pivot{$app}{$dev}{'allbros'}; ++$pivot{'allapps'}{'alldevs'}{$bro}; ++$pivot{$app}{'alldevs'}{'allbros'}; ++$pivot{'allapps'}{$dev}{'allbros'}; ++$pivot{'allapps'}{'alldevs'}{'allbros'}; } # statistics for accesses for my $app (sort keys %pivot) { for my $dev (sort keys %{$pivot{$app}}) { for my $bro (sort keys %{$pivot{$app}{$dev}}) { print "$app\t$dev\t$bro\t$pivot{$app}{$dev}{$bro}\n"; } print "------------------------------------------------\n"; } }

In reply to Re^3: TOTAL Element understanding - Why and how to use this? by hdb
in thread TOTAL Element understanding - Why and how to use this? by chandantul

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2022-08-08 17:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?