you are probably looking for the $& variable:
open(FILE,'file') || die $!;
while(<FILE>){
print $&,"\n" if(/silly/);
}
close(FILE);
__END__
you probably want to check out $`(pre match) and $'(post match) as well.
note the $&, $` and $' are kind of expensive and you usually can do the
above without using them which should make your program run faster.
david
Harry Putnam wrote:
> Hope this isn't too often repeated question with glaringly obvious
> answer:
> How to print only what a regex hits from a file, not the whole line.
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]