You may want to try $` $& and $'
my $string = 'abcdefhij';
$string =~ /(def)/;
print "$`:$&:$'";

**this prints: abc:def:hij


However, use of $`, $&, and $' will slow down ALL of your regular
expressions.

-----Original Message-----
From: Pakhun Alhaca
To: Michael Fowler
Cc: [EMAIL PROTECTED]
Sent: 8/21/2001 6:45 AM
Subject: Re: problem with filtering a corpus

Dear Perl-friends!

Thanks for quite a piece of advice in filtering my huge
corpus. Now it is smaller and easy to read thanks to you.
I bought "Perl for Beginners" and now I am working on my
basic skills. For couple of days I was finding all the
answers I wanted from my books but there is a new one that
I stuck with.
I use my corpus citating sentences one by one using
different input separators $/ (now I am quite good at it)
but I cannot make my script to give me not only a matching
string but one before and one after. I tried $_ minus/plus
1 but it couldn't work - it is obviously not a number...
How to tell Perl to give three strings (one
before/needed/one after)? I hope this is more difficult
than a previous one (^^)/
Thanks in advance!
Alhaca

__________________________________________________
Do You Yahoo!?
Yahoo! BB is Broadband by Yahoo!
http://bb.yahoo.co.jp/


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to