On Jun 16, Kevin Zhang said:
>One more question, how do I strip out all letters before "xyz". For the
>original example, how would I get "xyzb" and "xyzd"?
I would suggest this slightly modified grep():
my @matches =
grep { /(xyz.*)/ and ($_ = $1) }
split ' ', $string;
Here, instead of just making sure the fragment has 'xyz' in it, we're
capturing the 'xyz' and everything after it into $1, and then setting $_
equal to $1.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
CPAN ID: PINYAN [Need a programmer? If you like my work, let me know.]
<stu> what does y/// stand for? <tenderpuss> why, yansliterate of course.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>