|Problems? Is your data what you think it is?|
"Globbing" over variable names in Perl?by pat_mc (Pilgrim)
|on Sep 29, 2010 at 17:01 UTC||Need Help??|
pat_mc has asked for the
wisdom of the Perl Monks concerning the following question:
Esteemed Monks -
Here is my humble question for the day: Perl permits to access variables whose names were created in some (possibly systematic) way in the way illustrated in the following example.
returns the correct output '4'.
So here's my question: How can I obtain the list of all variables whose name matches a certain pattern? I am thinking of something analogous to globbing ('$a*') over variable names. Ideally, I would like to write code like
where @a should hold the names of all variables starting with $a, say, or mathing some other pattern of the variable name (not content!).
Did I explain this comprehensibly? And, if so, any help on this?