I thought if it were possible to initialize the variables per loop. My knowledge in Perl however is definitely not good enough to manage this.my $abc_this_01 = "C:/Stuff/abc_this_01.csv"; my $def_this_01 = "C:/Stuff/def_this_01.csv"; my $ghi_this_01 = "C:/Stuff/ghi_this_01.csv"; my $jkl_this_01 = "C:/Stuff/jkl_this_01.csv"; my $mno_this_01 = "C:/Stuff/mno_this_01.csv"; my $abc_this_02 = "C:/Stuff/abc_this_02.csv"; my $def_this_02 = "C:/Stuff/def_this_02.csv"; my $ghi_this_02 = "C:/Stuff/ghi_this_02.csv"; my $jkl_this_02 = "C:/Stuff/jkl_this_02.csv"; my $mno_this_02 = "C:/Stuff/mno_this_02.csv"; # ... my $abc_that_01 = "C:/Stuff/abc_that_01.csv"; my $def_that_01 = "C:/Stuff/def_that_01.csv"; my $ghi_that_01 = "C:/Stuff/ghi_that_01.csv"; my $jkl_that_01 = "C:/Stuff/jkl_that_01.csv"; my $mno_that_01 = "C:/Stuff/mno_that_01.csv"; # etc.
but it seems to be fundamentally wrong.use strict; use warnings; my @component = qw / abs def gki jkl mno /; for (@component) { my $comp = $_; our ${$comp.'_this_01'} = "C:/Stuff/${_}_this_01.csv"; }
In reply to How to declare variables per loop by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |