Well, seeing as you fail the conditions on option 1 I gave in Re: Trying to access hash from external perl file, that leaves a regular expression/eval combo after slurping the file. For the line you've posted above, you could use /(\Qmy %test_hash = (\E.*)/ to grab the necessary information. However, this would break if for example, the hash definition was on multiple lines or whitespace differed in any way from what you posted. All of these can be overcome with changes to the regex, but you need to know the specific use case, and presumably how this script might change in the future. And this whole approach presumes that the hash is defined completely in the statement in which it's declared.
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.
In reply to Re^2: Trying to access hash from external perl file
by kennethk
in thread Trying to access hash from external perl file
by ruhroh
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |