Shawn Hinchy <mailto:[EMAIL PROTECTED]> wrote:

: Is there any way to turn text from an array into variables?

Yes. Use a hash.


use List::Util 'sum';

my @array = qw(one two three);
my %variables;
@variables{ @array } = 1 .. 3;

my $answer = sum( @variables{ @array } );
print "Answer is : $answer.";

__END__


HTH,

Charles K. Clarkson
-- 
Mobile Homes Specialist
Free Market Advocate
Web Programmer

254 968-8328

http://www.clarksonenergyhomes.com/

Don't tread on my bandwidth. Trim your posts.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to