Re: i don't understand 'context sensitivity'
- From: Vivien MOREAU <vpm+news@xxxxxxxxxxxxx>
- Date: Fri, 14 Jan 2011 08:30:53 +0100
On 2011-01-14, Anster wrote:
what is different between
@array = ('a', 'b', 'c');
and
($array[0], $array[1], $array[2]) = ('a', 'b', 'c');
?
# Begin example 1
my @array = ('q', 'w', 'e', 'r');
print "Before:\n";
print "$_\n" for @array;
print "After:\n";
@array = ('a', 'b', 'c');
print "$_\n" for @array;
# End example 1
Before:
q
w
e
r
After:
a
b
c
# Begin example 2
my @array = ('q', 'w', 'e', 'r');
print "Before:\n";
print "$_\n" for @array;
print "After:\n";
($array[0], $array[1], $array[2]) = ('a', 'b', 'c');
print "$_\n" for @array;
# End example 2
Before:
q
w
e
r
After:
a
b
c
r
To see the difference between two things, just experiment! ;-)
--
Vivien MOREAU
.
- References:
- i don't understand 'context sensitivity'
- From: Anster
- i don't understand 'context sensitivity'
- Prev by Date: i don't understand 'context sensitivity'
- Next by Date: Re: i don't understand 'context sensitivity'
- Previous by thread: i don't understand 'context sensitivity'
- Next by thread: Re: i don't understand 'context sensitivity'
- Index(es):