@abc = ("Hi", "there", "how", "are", "you?");
print "@abc\n";
Sets the contents of @abc
and prints it,
giving: Hi there how are you?.
($abc) = ("Hi", "there", "how", "are", "you?");
print "$abc\n";
When assigning a longer list to a shorter, we loose the
extra items at the right. Therefore $abc
is assigned
"Hi"
, and the program prints Hi.
@abc = ("Hi", "there", "how", "are", "you?");
print "$abc[2]\n";
Prints how.
@abc = ("Hi", "there", "how", "are", "you?");
print "$abc\n";
Since $abc
is a different variable, unrelated to
@abc
, it is uninitialized and equal to the empty string.
Only the newline is printed.