On Tue, 2 Jan 2001, Alloun, Jonathan wrote:

> 
> Hello,
> 
> I have a parameter
> 
> my $name0 = "c:/test";
> 
> $name0 is used for opening a file throughout my program.
> 
> I have used it more than once and therefore it says that $name0 masks
> earlier declaration in same scope.
> 
> I have tried to undef $name0 but it still get this error.
> 
> The program will run but I would like to remove this error altogether.
> 
> What would you recommend I do in this case.
>

The form 'my $name0="c:/test"' is both a declaration (you can only do
the 'my' for a variable once) and an assignment (the :="c:/test" part)
which you can do as often as you like.

Only use 'my' the first time. Or alternatively do a separate declaration
and assignment of value, i.e.

my $name0;

Then just do '$name0="c:/test";' whenever you want to change the value
of $name0.

**** [EMAIL PROTECTED] <Carl Jolley>
**** All opinions are my own and not necessarily those of my employer ****

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users

Reply via email to