What does this line do in Perl?
my @parsedarray = ($rowcol =~ m/([A-Z]?)([0-9]+)/);
$rowcol is something like A1, D8 etc… and I know that the script somehow splits them up because the next two lines are these:
my $row = $parsedarray[0];
my $col = $parsedarray[1];
I just can’t see what this line does ($rowcol =~ m/([A-Z]?)([0-9]+)/); and how it works.
The operator m// is a pattern match, basically a synonym of //. This matches an optional first letter and then 1 or more digits in row column. An array is returned as the result of the match with each element containing one of the matched groups (in brackets). Therefore $parsedarray[0] contains the letter (or nothing) and $parsedarray[1] contains the digits.