This code should do it.
my $List = "uuuu axyzb oooo cxyzd vvvv";
my @Words = split(' ', $List);
print "@Words\n";
my $Word;
my @xyz;
foreach $Word (@Words) {
push @xyz, $Word if $Word =~ /.*xyz.*/;
}
print "@xyz";
"Kevin Zhang" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> Thanks in advance for your kind help.
>
> For the following string:
>
> "uuuu axyzb oooo cxyzd vvvv"
>
> What is the command to extract the substrings with "xyz" in them? In this
case, I'd like to get two strings "axyzb" and "cxyzd".
>
>
>
>
> ---------------------------------
> Do you Yahoo!?
> Yahoo! Mail is new and improved - Check it out!
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>