On Apr 19, 2008, at 12:39, Richard Lee wrote:

what is the difference?? I thought doing [ ] and \ would do the samething
snip

They do similar, but different, things. The \ operator takes a reference to a variable and [] operator creates an anonymous array. You can build [] from \ by using a temporary array that goes out of scope.

my $linked = [EMAIL PROTECTED];
my $independent = do { #this is functionally the same as my $independent = [EMAIL PROTECTED];
    my @temp = @array;
    [EMAIL PROTECTED];
}

Changes to @$linked will change @array, but changes to @$independent will not.

--
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to