in reply to need help using split()

my @split = $data =~ /\G(M|T|W|Th|F|Sa|Su|\d)/g; my @days = grep /\D/, @split; my @periods = grep /\d/, @split;

-- Randal L. Schwartz, Perl hacker


update: oops... order is wrong... see Re: Re: need help using split().

Replies are listed 'Best First'.
Re: Re: need help using split()
by chipmunk (Parson) on Mar 22, 2001 at 02:27 UTC
        my @split = $data =~ /\G(M|T|W|Th|F|Sa|Su|\d)/g; Th must come before T in the alternations for this to work properly. One way to write it: my @split = $data =~ /\G(Th|Sa|Su|[MTWF]|\d)/g;