in reply to split versus =~
split version
#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11148100 use warnings; for ( glob join '-', ('{-,}42') x 3 ) { my ($X, $Y, $Z) = split /(?<=\d)-/; printf "%11s => %3s %3s %3s\n", $_, $X, $Y, $Z; }
Outputs:
-42--42--42 => -42 -42 -42 -42--42-42 => -42 -42 42 -42-42--42 => -42 42 -42 -42-42-42 => -42 42 42 42--42--42 => 42 -42 -42 42--42-42 => 42 -42 42 42-42--42 => 42 42 -42 42-42-42 => 42 42 42
|
|---|