use strict; use warnings; my $dwarfs = [ qw(Doc Grumpy Happy Sleepy Sneezy Dopey Bashful) ]; print "@{$dwarfs}\n"; my @removed=(); my $removed=""; @removed = splice @{$dwarfs},3 ,2; #$removed = [ @removed ]; #1. please notice : this makes a copy first + of @removed . # changes to @{$removed} will NOT affect @removed # OUTPUT : Sleepy Sneezy $removed = \@removed ; #2. please notice : this is a hard reference +. # changes to @{$removed} will affect @removed. # OUTPUT : Sleepy # let's examine the above : Just uncomment one of the above beginning + with : $removed pop @{$removed} ; print "@removed\n";
In reply to Re: hard versus soft reference to ARRAY's
by teun-arno
in thread hard versus soft reference to ARRAY's
by teun-arno
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |