SPUG:Split question

Brian Wisti brian at coolnamehere.com
Fri Mar 21 18:00:34 CST 2003


In the spirit of TMTOWTDI:

	my @list = map { "$__," } split /,/ "a,b,c,d,e,f";
	print @list, "\n";


:-)

-Brian W

On Friday, March 21, 2003, at 02:57  PM, Jim Flanagan wrote:

> On Fri, 21 Mar 2003, Jim Flanagan wrote:
>
>> @array = $string =~ /([^,],)/g;
>>
>> Should get you what you want (in this particular case).
>
>   I omitted a crucial element: It should be
>
>       @array = $string =~ /([^,]+,)/g;
>
>   (In case you have "abc,123,def,");
>
> -- 
> ::jimfl
>
>     http://jimfl.tensegrity.net
>   mailto:jimfl%40t%65ns%65gr%69ty.n%65t
>
> _____________________________________________________________
> Seattle Perl Users Group Mailing List
> POST TO: spug-list at mail.pm.org
> ACCOUNT CONFIG: http://mail.pm.org/mailman/listinfo/spug-list
> MEETINGS: 3rd Tuesdays, U-District, Seattle WA
> WEB PAGE: www.seattleperl.org
>
>
>
>
Brian Wisti (brian at coolnamehere.com)
  - http://coolnamehere.com/




More information about the spug-list mailing list