Hello,

I've just started working with Perl and wanted to ask if there's a functionality for the following:

a) having a perl script compute some values

b) making those values globally reachable in such way so that other perl scripts can use them.

What I want to do:

A. have the output of the iproute package tc -s -d cl sh dev eth0 and eth1 copied in 2 files : stats.down, stats.up

(using a bash crontab rule)
I have already done this.

B. load these 2 files in 2 arrays($down and $up) then:

store in an index array the position in the $down array where each qos class has it's "Sent Bytes" stored.
(this is the same position for $up)

- I have already done this too -

With this data recomputed each 5 minutes I'd like to know if there any possibility for another script(rate.pl) to access the computed $index and the $down, $up arrays from the previous script (without recalculating them).

Then I would just call this second script for each traffic class I have and get the "Sent Bytes" without recomputing everything and eating up resources.

Am I looking for the impossible ? :)

In reply to Combining perl scripts by skyraven

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.