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)
|
---|
In Section
Seekers of Perl Wisdom