in reply to Re: Better way to perform "double split" ?
in thread Better way to perform "double split" ?
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Better way to perform "double split" ?
by 7stud (Deacon) on Nov 10, 2009 at 09:48 UTC |