Why not consider using a hash? If I understand you correctly you want to assign to variables that have names you don't now in advance.
use strict; my @interests = ( "foo", "bar", "blah"); my %hash; foreach (@interests) { $hash{$_} = "My interest is $_"; } foreach (keys %hash) { print "$hash{$_}\n"; }
Hope this helps, -gjb-
Update: Thanks dragonchild for pointing out a typo (%hash rather than @interests in the last foreach)
In reply to Re: use strict
by gjb
in thread use strict
by rsiedl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |