OR you can do

$line = 'blah>bluh>blug>';

@stuff = map { "$_>" } split />/, $line;


-----Original Message-----
From: Brett W. McCoy [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 15, 2002 5:40 PM
To: Agustin Rivera
Cc: [EMAIL PROTECTED]
Subject: Re: SPLIT


On Fri, 15 Feb 2002, Agustin Rivera wrote:

> How would I keep the character (or characters) that I am splitting by?
>
> for example,
>
> @tags=split(/>/, $line);
>
> I would like to keep the ">".

In other words, you have the string 'blah>bluh>blug>', you want to split
it, and end up with ("blah>", "bluh>", "blug>") ?

You can do

  split /(>)/, $line

This would give you ("blah", ">", "bluh", ">", "blug", ">").

Otherwise, you'd probably need to do a general regular expression and pull
apart the string.

-- Brett
                                          http://www.chapelperilous.net/
------------------------------------------------------------------------
Blessed are the forgetful:  for they get the better even of their blunders.
                -- Nietzsche


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

----------------------------------------------------------------------------
--------------------
The views and opinions expressed in this email message are the sender's
own, and do not necessarily represent the views and opinions of Summit
Systems Inc.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to