in reply to Understanding alternation
In list context the regex returns all the matches.
#!/bin/perl5 use strict; use warnings; my $text = "The dog is black cat is white and the fox does not like th +e 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.
|
|---|