Help for this page
my $pat = qr/\w+ ((w)hite|(b)lack)/; ... $_ = 'but some white spaces'; print "$1 starts with $+\n" if /$pat/;
my $pat = qr/\w+ ((w)hit(e)|(b)lac(k))/; ... $_ = 'but some white spaces'; ($word, $first, $last) = grep defined $_, /$pat/; print "$word starts with $first and ends with $last\n" if $word;
my $pat = qr/\w+ ((w)hit(e)|(b)lac(k))/; $str = 'mostly black but some white spaces'; ... :() } 0..$#+; }