ktb wrote:
I've read the faq on "do" and looked around the web but can't discover
what I'm doing wrong.

I have a file named "text" with the following line it it -
$name = "kent";

My prog contains the following -
#!/usr/bin/perl
use diagnostics;
use strict;
use warnings;

do "$ENV{HOME}/scratch/address_book/text";
my $name;
print "$name\n";

The problem I'm having is my print statement just prints a new line
without printing any text. It was my understanding that the "do" function would pull the scalars from "text" into my prog as if it was part of the program.
It may be doing just that, but with the line:

my $name;

After the 'do' you are resetting the variable. You should be using 'our' instead of 'my'.

perldoc -f our
perldoc -f my

http://danconia.org


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to