CPU: Perl, Fall 2005 Perl, Week 3: More Arrays, Context, Subroutines, Lexical Variables #17

Arrays in Strings: Gotchas, 2

@foo = qw( red green blue );
$foo = 'gerbil';
print "$foo[2]\n";
print "$foo\[2]\n";
print "${foo}[2]\n";
Copyright © 2005 Ian Langworth