in reply to dynamically created variables

Also if the file provides you with the names of each item being read in, you may want to use a hash. If so, you can do it like this:

use strict; use warnings; my %hash; while (my $line = <DATA>) { my ($key,$value) = $line =~ /^\s*(.+?)\s*=\s*([^\s]+?)\s*$/; $hash{$key}=$value; } foreach ( keys %hash ) { print $_, "=", $hash{$_}, "\n"; } __DATA__ Test 1 = 10 Test 2 = 20 Test 3 = 30

The preceding example strips leading and trailing whitespace from the keys and values stored in the file prior to inserting the key/value pairs into a hash for later use. The example breaks down if your keys or values actually contain '=' signs embedded within. I didn't use split because I wanted simpler control over the stripping of whitespace. The example also preserves whitespace if it occurs embedded within a key, but disallows it in the value. You could easily change that behavior.

Hope this helps...

Dave

"If I had my life to do over again, I'd be a plumber." -- Albert Einstein