in reply to RE: RE: RE: getting hashes out of config files
in thread getting hashes out of config files

double quotes and no quotes yield the same result as single quotes ... i have been using hte following to test:
do('filename'); %hashname = %$VAR1; print "$hashname{name} \n\n"; ###the above works fine ###the code below only prints the \n's $filename = "filename"; do($filename); %hashname = %$VAR1; print "$hashname{name} \n\n";
thanks again

Replies are listed 'Best First'.
RE: RE: RE: RE: RE: getting hashes out of config files
by Fastolfe (Vicar) on Oct 25, 2000 at 22:47 UTC
    This works for me:
    $ cat test do('test2'); print "var=$var\n"; $ cat test2 $var="test variable"; $ perl test var=test variable
    Make sure 'filename' exists and is valid Perl. In addition, each of my examples has included an 'or die...' bit, yet you've consistently ignored this hint. Upon failure, do will return undef and set either $! to an error indicating a failure to read the file, or $@ with an error message describing a compilation or run-time error evaluating the contents of the file. Check for these errors and print them out. I suspect your problem will be clear at that point.
    do($filename) or die "$filename: " . ($! ? $! : $@);