I tried writing a subroutine that iterates through a list of strings and prints each string, but it doesn't work:
use HTTP::Date;
my @date_strings_array = ("Jun 1, 2026", "Aug 26, 2018 GMT-05:00", "Aug 26, 2018");
print_datetimes(@date_strings_array);
sub print_datetimes {
my @date_string_array = shift;
foreach $date_string (@date_string_array) {
print("The current iteration is $date_string.");
}
}
It only prints the first iteration:
$ perl /example/test.pl
The current iteration is Jun 1, 2026.
Why does this only print the first item in the array?