in reply to What am I doing wrong here?
But looking at your code, it doesn't look as though @X needs to be global - I'd rewrite it like this:
Have a read of perlman:lib:strict and perlman:perlsub.use strict; my $test = 'test'; my @X = values(); guest2(\@X, $test); sub values ( my @Y = qw(something something); return @Y; ) sub guest2 ( my @X = @{shift()}; # these copies of @X and $test my $test = shift ; # don't exist outside guest2() }
hth,
andy.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: What am I doing here?
by mce (Curate) on Dec 05, 2001 at 16:02 UTC |