fork download
  1. #!/usr/bin/perl
  2.  
  3. my $str = "Extract all words but word1 and word2.";
  4. @list = ($str =~ m/\b(?!(?:word1|word2)\b)(\w+)/g);
  5. print(join "\n", @list);
  6.  
Success #stdin #stdout 0s 4932KB
stdin
Standard input is empty
stdout
Extract
all
words
but
and