in reply to Declaring and checking content of variables with consecutive names
Don't.
The usual approach is to either use an array, @str, or a hash, %str.
Access them as:
my @str; $str[0] = ''; $str[1] = ''; ... $str[99] = ''; print join ",", @str;
or for the hash version:
my %str; $str{0} = ''; $str{1} = ''; ... $str{99} = ''; print join ",", map {$str{$_}} 0..99;
See also Why it's stupid to `use a variable as a variable name'
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Declaring and checking content of variables with consecutive names
by rflesch (Novice) on Sep 23, 2016 at 12:23 UTC |
In Section
Seekers of Perl Wisdom