Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^2: How to declare variables per loop

by wfsp (Abbot)
on Oct 13, 2011 at 07:53 UTC ( #931151=note: print w/ replies, xml ) Need Help??


in reply to Re: How to declare variables per loop
in thread How to declare variables per loop

Looks good. I would leave it at that but, perhaps for future reference, I couldn't resist a further tweak. :-)

# ... my %titles = ( q{01} => q{First}, q{02} => q{Second}, q{03} => q{Third}, q{04} => q{Fourth}, q{05} => q{Fifth}, q{06} => q{Sixth}, ); my @cmds; for my $number (qw{01 02 03 04 05 06}){ my $cmd = build_command($number, $titles{$number}, %args); push @cmds, $cmd; } # ...
sub build_command { my $num = shift; my $title = shift; my %args = @_; my $cmd = sprintf( qq{set title "The %s Indicator\n"}, $title, ); # ....
... ###################################### $multiplot_title $cmds[0] $cmds[1] unset multiplot ...


Comment on Re^2: How to declare variables per loop
Select or Download Code
Re^3: How to declare variables per loop
by vagabonding electron (Hermit) on Oct 13, 2011 at 08:55 UTC
    Thank you very much wfsp.
    After overnight I thought even that it were possible to combine the title for the evaluation and the titles for the diagramms in one hash. One should then input a shorthand for the evaluation at the command line.
    This below is just a fragment, I am tinkering now : -)
    Thanks again!
    VE
    use strict; use warnings; if (!defined $ARGV[0]) { die " Please type the shorthand: THIS for This Great Evaluation THAT for That Small Evaluation "; } my $topic = $ARGV[0]; my %module = ( THIS => [ { name => q{This Great Evaluation}, indicator => { '01' => q{The First}, '02' => q{The Second}, }, }, ], ); print ${module}{$topic}[0]->{name}; print ${module}{$topic}[0]->{indicator}{'01'}; print ${module}{$topic}[0]->{indicator}{'02'};

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://931151]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (10)
As of 2015-07-06 15:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (77 votes), past polls