Michael G Schwern writes: > I'd love to be able to do it with a grep like thing. > > (@switches, @args) = seperate /^-/, @ARGV;
Yes. I've written that function in Perl 5, which isn't ideal, because you have to return array refs, not arrays. However, I don't think it should be called 'seperate'. I also don't think it should be called 'separate', because that word seems to be commonly misspelled... It's hard to come up with a good name, though. Bad ones I've thought of include: grepboth - The unpleasant name my Perl 5 implementation has split - Overloaded meaning -- but we could perhaps get away with scalar-split and array-split being different characterize - Or do I mean 'characterise'? partition classify - These are the two I dislike least > @switches = @ARGV.cull /^-/; > > Array.cull would remove and return a list of every element in @ARGV which > matched. I'm not so fond of that -- I don't think it's as obvious that you're doing a two-way classification. -- Aaron Crane * GBdirect Ltd. http://training.gbdirect.co.uk/courses/perl/