(The post about 'purge' just made me remember this idea) Lets say you have a list of program arguments.
@ARGV = ('foo', '--bar=baz', 'yar'); and you want to seperate that into two lists. One of switches and one of normal args. You can't just use a grep, you'd have to do this: my @switches = (); my @args = (); foreach (@ARGV) { if( /^-/ ) { push @switches, $_; } else { push @args, $_; } } and that's just entirely too much work. I'd love to be able to do it with a grep like thing. (@switches, @args) = seperate /^-/, @ARGV; seperate() simply returns two lists. One of elements which match, one of elements which don't. I think Perl 6 will allow the above syntax to work rather than having to play with array refs. An alternative/additional way to do it would be as an Array method. @switches = @ARGV.cull /^-/; Array.cull would remove and return a list of every element in @ARGV which matched. -- Michael G. Schwern <[EMAIL PROTECTED]> http://www.pobox.com/~schwern/ Perl Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job One Let me check my notes. http://www.sluggy.com