Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: Surprised by split

by extremely (Priest)
on Aug 11, 2005 at 14:18 UTC ( #482969=note: print w/replies, xml ) Need Help??


in reply to Re: Surprised by split
in thread Surprised by split

Hmm:
$ perl -e '$a="m|b|a"; print join(",",split "\\|",$a),$/' m,b,a $ perl -e '$a="m|b|a"; print join(",",split /\|/,$a),$/' m,b,a $ perl -e '$a="m|b|a"; print join(",",split m/\|/,$a),$/' m,b,a $ perl -e '$a="m|b|a"; print join(",",split qr/\|/,$a),$/' m,b,a $ perl -e '$a="m|b|a"; $b=qr/\|/; print join(",",split $b,$a),$/' m,b,a $ perl -e '$a="m|b|a"; sub b{return qr/\|/}; print join(",",split b(), +$a),$/' m,b,a $ perl -e '$a="m|b|a"; print join(",",split "[|]",$a),$/' m,b,a

Man, I love perl. :) (Updated a couple of times to add new variations)

--
$you = new YOU;
honk() if $you->love(perl)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://482969]
help
Chatterbox?
[karlgoethebier]: Rap rhymes to crap. Ouch!
[karlgoethebier]: Unne hip unne hop unne schoppe inne kopp...
[1nickt]: kgb not quite as simple as ... and ...; are interchangeable. There are edge cases, shown in perlsyn.
[1nickt]: Hm well actually I guess it's not the trailing semi-colon that's at issue there, it's disambiguation between the ellipsis and the binary flip-flop

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (8)
As of 2017-11-18 19:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (277 votes). Check out past polls.

    Notices?