http://www.perlmonks.org?node_id=1210293


in reply to printing element of anonymous array

Using the core Perl module Time::Piece (which overrides the built-in functions localtime and gmtime, providing functions that return objects):

use Time::Piece;
print gmtime->wday;


The way forward always starts with a minimal test.