for my $l (@links) { next if $l->url() =~ /foo/; push ( @non_foo_links, $l ); ...