in reply to foreach in array
Indeed you do! For a start always use strictures (use strict; use warnings; - see The strictures, according to Seuss).
You don't need to interpolate the string in print.
If all you are doing is printing each "line" from @data then you can:
use strict; use warnings; my @data = ...; print for @data;
foreach is a synonym for for.
The code you show will print all the contents of @data. If it doesn't print what you expected than @data doesn't contain what you expected.
|
|---|