By way of explanation:
my ($date)
provides a 'list context'. In other words, $date is part of a list of variables, where the list happens to be of length 1. That list of variables expects to be assigned a list of values. In response to that demand, the match operator m/// returns a list of of the actual matches to the parenthesized groupings in the regex.
If m/// happened to return more than one value, because there were multiple parenthesized groupings in the regex, then the rules of list assignment would take over: extra values on the right hand side of a list assignment are discarded. Here is an example:
use strict; use warnings; use 5.010; my ($a, $b) = (1, 2, 3); say $a; #1 say $b; #2
In reply to Re^2: Better way to perform "double split" ?
by 7stud
in thread Better way to perform "double split" ?
by perlpal
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |