On Sun, Feb 16, 2003 at 12:05:57PM -0500, Wiggins d'Anconia wrote:
> 
> 
> 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
> 

Thanks much had not heard of "our" till now.  That did the trick:)
kent

-- 
To know the truth is to distort the Universe.
                      Alfred N. Whitehead (adaptation)

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

Reply via email to