Choosing grouping of split items
From: fishfry (BLOCKSPAMfishfry_at_your-mailbox.com)
Date: 02/15/04
- Next message: Bart Lateur: "Re: Problems with version 5.8.0 on OS/2"
- Previous message: KK: "Re: Save the Bandwidth -smarter way to send the same file attachment to N users?"
- Next in thread: Juha Laiho: "Re: Choosing grouping of split items"
- Reply: Juha Laiho: "Re: Choosing grouping of split items"
- Reply: Anno Siegel: "Re: Choosing grouping of split items"
- Reply: Jay Tilton: "Re: Choosing grouping of split items"
- Maybe reply: Uri Guttman: "Re: Choosing grouping of split items"
- Reply: John W. Krahn: "Re: Choosing grouping of split items"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 15 Feb 2004 08:29:25 GMT
If I have
$text = 'abc - def - ghi - jkl";
then
@tokens = split(/-/, $text, 3);
splits the line into abc, def, ghi - jkl (ignoring leading and trailing
spaces).
I have an application where there may be 3 or 4 items separated by '-'
but if there are 4, I want them returned as abc - def, ghi, and jkl.
Is there a one-liner for that?
- Next message: Bart Lateur: "Re: Problems with version 5.8.0 on OS/2"
- Previous message: KK: "Re: Save the Bandwidth -smarter way to send the same file attachment to N users?"
- Next in thread: Juha Laiho: "Re: Choosing grouping of split items"
- Reply: Juha Laiho: "Re: Choosing grouping of split items"
- Reply: Anno Siegel: "Re: Choosing grouping of split items"
- Reply: Jay Tilton: "Re: Choosing grouping of split items"
- Maybe reply: Uri Guttman: "Re: Choosing grouping of split items"
- Reply: John W. Krahn: "Re: Choosing grouping of split items"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|