#!/usr/bin/env perl use warnings; use strict; while () { #my @no_reds = grep { !/^r/i } split; my @no_reds = grep { !/^r/i } split /[\s\(\)]/; print "@no_reds\n"; } __DATA__ 12345 Gray 6789 Red rd 555 blue 888 red 777 green 999 foo bar r baz ruby goo(r) ruby doobie 888red999