Why does this code:

#!/usr/bin/perl -w

#use strict;

@a = qw/this is the text/;
$a = "three";
print "The third word is ${a}[2]\n";
print "The third word is $a[2]\n";

produce this:

The third word is three[2]
The third word is the

and this code:

#!/usr/bin/perl -w

use strict;

my @a = qw/this is the text/;
my $a = "three";
print "The third word is ${a}[2]\n";
print "The third word is $a[2]\n";


produce this?

Use of uninitialized value in concatenation (.) at ./test.pl line 7.
The third word is [2]
The third word is the


I didn't think there was any use of concatenation (.) in line 7.
Thanks,
Keith

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to