in reply to defining a new var on the spot
Yes you can do it. Look up "symbolic references" in any decent Perl book and you'll see an explaination of how to do it - right next to an explaination of why it's such a bad idea. For a good explaination of why you shouldn't do it see these three articles.
It's such a bad idea that if you run your programs under use strict (as everyone should do) then symbolic references are explicity flagged as an error.
A much better idea would be to create a hash or arrays (perhaps call it %arrays where you can store these values.
my %arrays; $tmp =~ /(.+)(\d+)$/; $arrays{$1}->[$2] = 'some value';
Oh, and this is a very frequently asked question round here. I find it impossible to believe that Super Search wouldn't have shown you many nodes all saying the same thing.
--"The first rule of Perl club is you do not talk about
Perl club."
-- Chip Salzenberg
|
|---|