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 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With