in reply to Re^3: Why is my loop dropping alphabetic strings?
in thread Why is my loop dropping alphabetic strings?

Sorry, I wasn't clear: since you are using strict, that prevents Perl from treating the bareword as a string. Since you're doing it within an eval, your program doesn't die as it would if you did the same thing in non-eval code. It just fails to work. The post I replied to showed how to see any errors happening within the eval, so you can see why it's not working.

The numeric assignment works because numbers don't ever have to be quoted like strings. Your eval sees two assignments, like these:

$foo = 1; # no problem $bar = string; # bareword, fails under 'strict subs'

And as Grandfather said, unless you're doing this as an exercise to learn how eval works, it's probably a really, really bad idea. Unless you have a very good reason that these values need to be in scalar variables instead of the %ENV hash (and there's nothing in your example to indicate that), just access the values from the hash where they belong. Anywhere that you're planning to use $FOO, there's no reason you can't use $ENV{FOO}.

Aaron B.
Available for small or large Perl jobs; see my home node.