12548Re: [Clip] splitting a string on a character
- Oct 3, 2004Don Passenger wrote:
[ . . ]
> Perl has a split function that does this type of thing, but I am notHugo has shared the equivalent:
> finding the equivalent.
my( @stuff ) = split( /:/, $SomeDataString ) ;
But if your char also is a *Perl* meta char (for example, just such as
the pipe or | char is) then such meta char need be escaped (\ escapes,
makes so is interpreted as a literal), thus:
my( @stuff ) = split( /\|/, $SomeDataString ) ;
Perl split does use a character as a delimiter then all item(s) between
delimiter(s) are split off so to speak (or, put into an array).
- << Previous post in topic