Perl syntax error: Bareword found where operator expected
As the title suggests how could I accomplish this?
I have been following a tutorial, but I get a syntax error:
Bareword found where operator expected at arrays_and_variables.pl line
26, near "$2names"
(Missing operator before names?) syntax error 开发者_JS百科at
arrays_and_variables.pl line 26, near "$2names " Execution of
arrays_and_variables.pl aborted due to compilation errors.
The code I have so far is:
@names = ('james','dylan','max');
# join elements of array into a schalar variable.
$2names = join ('', @names);
print $s2names;
2names
is an invalid variable name. Names can't start with a number—they have to begin with a letter or an underscore.
精彩评论