in reply to how can print the variable values
General rule of thumb: whenever you find yourself creating a collection of variables, you should use a hash (or occasionally an array) instead. Also, when you find yourself using a C-style 'for(;;)' loop, you should consider whether it's actually the right thing. Most times, it's not.
### Array # Indexes of 0-4 automatically assigned by Perl! my @kpi = qw/10 20 30 40/; print "line$kpi[$_]\n" for 0..4; ### Hash my %kpi; # Populating via hash slice to save typing @kpi{0..4} = qw/10 20 30 40 50/; print "line$kpi{$_}\n" for 0..4;
|
|---|