in reply to split with separators but dont include in the array

anniyan,
Sometimes it is important to start out with functional code and then work on improving it to be "right". Have you considered making it two steps?
my @matches = grep { $_ !~ /(\&\&|\|\|)/ } split /(\&\&|\|\|)/, $str;
This obviously isn't the way you want to leave the final code but it is better to having something that works that you are unhappy with then something that doesn't work at all. You can always improve.

Cheers - L~R

Commentary after the code snippet added

Replies are listed 'Best First'.
Re^2: split with separators but dont include in the array
by anniyan (Monk) on Oct 17, 2005 at 15:37 UTC

    Thanks, Yes it works fine, is it not possible to write with lookahead and look behind?

    Regards,
    Anniyan
    (CREATED in HELL by DEVIL to s|EVILS|GOODS|g in WORLD)