pat_mc has asked for the wisdom of the Perl Monks concerning the following question:
returns the correct output '4'.perl -le '$a1 = 3; $a2 = 4; $c = 2; print ${a . $c}'
where @a should hold the names of all variables starting with $a, say, or mathing some other pattern of the variable name (not content!).for ( @a ) { print ${ $_ }; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: "Globbing" over variable names in Perl?
by Anonymous Monk on Sep 29, 2010 at 17:16 UTC | |
by pat_mc (Pilgrim) on Sep 29, 2010 at 17:33 UTC | |
by AnomalousMonk (Archbishop) on Sep 29, 2010 at 19:19 UTC | |
|
Re: "Globbing" over variable names in Perl?
by jethro (Monsignor) on Sep 29, 2010 at 17:11 UTC | |
by pat_mc (Pilgrim) on Sep 29, 2010 at 17:28 UTC | |
|
Re: "Globbing" over variable names in Perl?
by DrHyde (Prior) on Sep 30, 2010 at 09:52 UTC | |
|
Re: "Globbing" over variable names in Perl?
by suhailck (Friar) on Sep 29, 2010 at 17:29 UTC |