in reply to Concatenate printing a string and array
Was that on purpose or a typo that you have a period (.) instead of a comma (,) between the string and your @array ?
If the former, you should read up about context. The concatenation operator (.) joins two scalars, so the array is in scalar context (i.e. the concatenation needs a scalar, so the array provides a scalar). An array provides its size in scalar context, in this case 4
The parameters of a print on the other hand (with the possible exception of the optional filehandle parameter) provide list context which is why a comma works
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Concatenate printing a string and array
by shawnhcorey (Friar) on Jan 05, 2009 at 15:36 UTC | |
|
Re^2: Concatenate printing a string and array
by shawnhcorey (Friar) on Jan 05, 2009 at 15:35 UTC |