I think i know what you are looking for.
If so, then there are 2 ways to do this.
First you need to match everything before what you are looking for, then
match your string, and then match everything after. Now, this will only
work if you know _exactly_ what you are looking for.
$your_string = "This is the pattern to match exactly";
my @matched_string = split(/(.*)?($your_string)(.*)?/,$entire_string);
You can also do
my (@matched_string) = ($entire_string =~ /(.*)?($your_string)(.*)?/);
Again, this is assuming that you know the exact string to split your
string with. I would use split in this case, it makes more sense to
follow in the future if you, or someone else, is trying to understand
what you are doing here.
-Akshay
Pakhun Alhaca wrote:
>
> 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]