I have a defined days array with the square bracket in Perl. I want to access each element of the array. A similar example from the code below(This is just a snippet of code):
@days = [a,2,3];
foreach(@days){print "$_\n";}
print "\n\n @days";
And output is:
ARRAY(0x2032950)
ARRAY(0x2032950)
I need to access the array elementS but I cannot change the @days declaration. The following code is not working as well:
@days = [a,2,3];
use feature qw<say>;
foreach(@days){print "$_\n";}
print "\n\n @days\n";
print "@$days\n";
say $_ for $days->@*;

@daysarray using a list instead of using an array reference? As it is now, you have@dayswith a single element which is a reference to an array.use strict; use warnings;to your scripts.