plot $years $yscala "$abc_this_01" title "" with errorbars lt rgb "$color_abc" lw 2, "$abc_this_01" title "{/Helvetica=10 ABC_Stuff}" with lines lt rgb "$color_abc" lw 3, "$def_this_01" title "" with errorbars lt rgb "$color_def" lw 2, "$def_this_01" title "{/Helvetica=10 DEF_Stuff}" with lines lt rgb "$color_def" lw 3, "$ghi_this_01" title "" with errorbars lt rgb "$color_ghi" lw 2, "$ghi_this_01" title "{/Helvetica=10 GHI_Stuff}" with lines lt rgb "$color_ghi" lw 3, "$jkl_this_01" title "" with errorbars lt rgb "$color_jkl" lw 2, "$jkl_this_01" title "{/Helvetica=10 JKL_Stuff}" with lines lt rgb "$color_jkl" lw 5, "$mno_this_01" with steps lt 1 lw 5 title "{/Helvetica=10 Abnormality Border}" #### #! /usr/perl/bin use warnings; use strict; my %args = ( years => 2011, yscala => q{xxx}, sources => [ { source => q{abc}, color => q{red}, }, { source => q{def}, color => q{blue}, }, { source => q{ghi}, color => q{yellow}, }, { source => q{jkl}, color => q{green}, }, ], topic => q{this}, number => q{01}, abnormality_border => q{mno}, ); my $cmd = build_command(%args); print $cmd; sub build_command { my %args = @_; my $cmd = sprintf( qq{plot %s %s\n\n}, $args{years}, $args{yscala} ); for my $source (@{$args{sources}}){ $cmd .= sprintf( qq{"C:/Stuff/%s_%s_%s.csv" title "" with errorbars lt rgb "%s_%s" lw 2,\n}, $source->{source}, $args{topic}, $args{number}, $source->{color}, $source->{source}, ); $cmd .= sprintf( qq{"C:/Stuff/%s_%s_%s.csv" title "{/Helvetica=10 ABC_Stuff}" with lines lt rgb "%s_%s" lw 3,\n\n}, $source->{source}, $args{topic}, $args{number}, $source->{color}, $source->{source}, ); } $cmd .= sprintf( qq{"C:/Stuff/%s_%s_%s.csv" with steps lt 1 lw 5 title "{/Helvetica=10 Abnormality Border}"}, $args{abnormality_border}, $args{topic}, $args{number}, ); return $cmd; } #### plot 2011 xxx "C:/Stuff/abc_this_01.csv" title "" with errorbars lt rgb "red_abc" lw 2, "C:/Stuff/abc_this_01.csv" title "{/Helvetica=10 ABC_Stuff}" with lines lt rgb "red_abc" lw 3, "C:/Stuff/def_this_01.csv" title "" with errorbars lt rgb "blue_def" lw 2, "C:/Stuff/def_this_01.csv" title "{/Helvetica=10 ABC_Stuff}" with lines lt rgb "blue_def" lw 3, "C:/Stuff/ghi_this_01.csv" title "" with errorbars lt rgb "yellow_ghi" lw 2, "C:/Stuff/ghi_this_01.csv" title "{/Helvetica=10 ABC_Stuff}" with lines lt rgb "yellow_ghi" lw 3, "C:/Stuff/jkl_this_01.csv" title "" with errorbars lt rgb "green_jkl" lw 2, "C:/Stuff/jkl_this_01.csv" title "{/Helvetica=10 ABC_Stuff}" with lines lt rgb "green_jkl" lw 3, "C:/Stuff/mno_this_01.csv" with steps lt 1 lw 5 title "{/Helvetica=10 Abnormality Border}"