Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: split versus =~

by tybalt89 (Monsignor)
on Nov 10, 2022 at 18:44 UTC ( [id://11148114]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11148114]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-03-28 17:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found