[Israel.pm] split

Yuval Kogman lists at woobling.org
Tue Feb 24 01:00:05 PST 2004

On Tue, Feb 24, 2004 at 10:51:11 +0200, Yossi.Itzkovich at ecitele.com wrote:

> Hi,

Hi ho!

> Is there a way to get split()  to return the delimiter too ?

Yes, just capture what you want to keep

	split /(\s+)/;

for example, will make a list of $_, which will look like

	"foo"," ","bar"

if $_ was "foo bar".

Ciao ciao!

 ()  Yuval Kogman <nothingmuch at woobling.org> 0xEBD27418  perl hacker &
 /\  kung foo master: /me sushi-spin-kicks : neeyah!!!!!!!!!!!!!!!!!!!!

More information about the Perl mailing list