in reply to split versus =~
Like this?
#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11148100 use warnings; for ( glob join '-', ('{-,}42') x 3 ) { my ($X, $Y, $Z) = /(-?\d+)-(-?\d+)-(-?\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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: split versus =~
by parv (Parson) on Nov 10, 2022 at 22:01 UTC |