[Chicago-talk] map and pop

Brian Katzung briank at kappacs.com
Mon Dec 29 17:35:52 CST 2003


Dooley, Michael wrote:
> I want to do something like this, but I also want to remove the found
> element from @files.
> 
> my @nfiles=grep /^car/, @files;
> 
> can anyone point me in the right direction, I am thinking map is needed but
> I don't have much confidence using it.

Why not just:

my @nfiles = grep /^car/, @files;
@files = grep !/^car/, @files;

-- 
Brian Katzung, President, Kappa Computer Solutions, LLC
Phone +1.877.367.8837 or visit http://www.kappacs.com/




More information about the Chicago-talk mailing list