in reply to Strange construct
It's a subscript, like used with an array, or in this case, a list.
my $value = ('a', 'b', 'c', 'd')[1]; say $value;
...prints b
Very convenient as a quick and dirty tool in situations like this:
my $keep = ( split /\s+/, $string )[2];
...although as with most things in Perl, that's only one of many ways to grab the third space-delimited item in a string.
Dave
|
|---|