in reply to Re: array assignment
in thread array assignment
What you have there will work but I would not use map to iterate over a list with only one element like that. It's confusing (another programmer coming to this code will likely struggle to understand why it has been done this way) and probably inefficient.
FWIW, these days we have Time::Piece in core so if you want to do this sort of date decomposition in 2022 that's what I would use and recommend:
#!/usr/bin/env perl use strict; use warnings; use Time::Piece; my ($dd, $mm, $yyyy) = split /-/, localtime->dmy;
This also helps save you from bugs if/when getting the maths wrong or using the wrong positions in the source array.
🦛
|
|---|