RE: Split question
From: Wiggins D Anconia (wiggins_at_danconia.org)
Date: 12/15/03
- Next message: Kevin Old: "How do you build your HTML?"
- Previous message: Alan Perry: "RE: Split question"
- Maybe in reply to: Perl: "Split question"
- Next in thread: Charles K. Clarkson: "RE: Split question"
- Reply: Charles K. Clarkson: "RE: Split question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 15 Dec 2003 08:32:19 -0700 To: beginners@perl.org
> On Monday, December 15, 2003 03:05, John W. Krahn wrote:
>
> >Here is a little quiz for you beginners out there. split() treats its
> >first argument as a regular expression. There are TWO exceptions where
> >the first argument does not behave the same as a normal regular
> >expression. What are they?
>
> The first one that comes to mind is using // for your search. Rather than
> repeating the last search, it searches for the null string to split on.
>
> The second one is if you include parentheses in your regex. If you put
> parentheses around your regex, then split will create entries for each of
> the matched terms in addition to the just the "splitted" items.
>
> So, do I win a prize or something? :)
>
But parentheses are normal in a regex, though granted the return is odd.
I would guess as the second the special case where ' ' is passed and the
string is split on whitespace which is not interesting, but where
leading space is skipped?
-- Boycott the Sugar Bowl! You couldn't pay me to watch that game.
- Next message: Kevin Old: "How do you build your HTML?"
- Previous message: Alan Perry: "RE: Split question"
- Maybe in reply to: Perl: "Split question"
- Next in thread: Charles K. Clarkson: "RE: Split question"
- Reply: Charles K. Clarkson: "RE: Split question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|