#!/bin/perl5 use strict; use warnings; my $text = "The dog is black cat is white and the fox does not like the cow or pig"; my (@array) = $text =~ /(cow|dog|pig)/g; print "@array\n"; __DATA__ ---------- Capture Output ---------- > "C:\Perl\bin\perl.exe" _new.pl dog cow pig > Terminated with exit code 0.