in reply to Fetching Only Month and Year From localtime()

Either

$year = 1900 + (localtime)[5]; $mon = 1 + (localtime)[4];
or
(undef, undef, undef, undef, $mon, $year) = localtime; $mon += 1;
or, combining the two
($mon, $year) = (localtime)[4,5]; $mon += 1; $year += 1900; warn $year +, " ", $mon;

In all these cases, the parentheses do the magic: in the first case, (LIST)[INDICES] the parenthesis is part of the syntax of the indexing operator. In the second case, the parentheses make the assignment a list assignment.

It's because all this magic (and the magic of the x operator), that some people think parenthesis are the operator for creating lists in perl.

Just one more thing about parens: qw/jan feb mar apr may jun jul aug sep oct nov dec/[(localtime)[4]] returns the abbrev of the current month (don't use this, as it does not take locales into account), and it does indexing without parenthesis or a silgil ($ or @), so it contradicts to what I've said.