Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
Thank you tospo.
The problem is that not each number can be combined with each evaluation name. Therefore I do need a config file. In fact I happened to populate the hash %module reading the csv-file in the following way:
open(my $fh, "<", "parameter.csv") or die "$!"; my $header = <$fh>; while(<$fh>) { my @line = split(/;/, $_); my $t = $line[0]; ${module}{$t}{name} = $line[1]; my $n = $line[2]; ${module}{$t}{indicator}{$n}{ind} = $line[3]; ${module}{$t}{indicator}{$n}{yscala} = $line[4]; } close $fh;
The file names in the gnuplot command are generated afterwards on the fly whereby only the names are created which are allowed by config file.
After that I used the code from wfsp from Re^2: How to declare variables per loop in the following way:
my @cmds; for my $number (sort keys %{${module}{$topic}{indicator}}){ my $cmd = build_command($number, %args); push @cmds, $cmd; } for (my $i=0; $i<@cmds; $i++) { if($i == 0 or $i % 2 == 0) { $cmds[$i] = "$multiplot\n\n$cmds[$i]"; } } for (my $i=0; $i<@cmds; $i++) { if($i % 2 == 1 or $i == $#cmds) { $cmds[$i] = "$cmds[$i]\n\n unset multiplot\n\n"; } } my $slurpline; for (my $i=0; $i<@cmds; $i++) { $slurpline.=$cmds[$i]; }

The gnuplot command itself is very short now:
open my $P, "|-", "gnuplot" or die; printflush $P qq[ $postscript $slurpline ]; close $P;

Thanks again!
VE

In reply to Re^4: How to access a hash from another file by vagabonding electron
in thread How to access a hash from another file by vagabonding electron

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!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            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.
  • Log In?
    Username:
    Password:

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

    How do I use this? | Other CB clients
    Other Users?
    Others chanting in the Monastery: (11)
    As of 2014-09-23 22:21 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      How do you remember the number of days in each month?











      Results (241 votes), past polls