embeding awk script in perl program

Collegues
I have an AWK script like the following.
{
if ($2 ~ /JJ/ && $4 ~ /IN/)
{
print $2, $3, $4, $5
}
}
How can I embed it in a perl program.

Jaganadh.G

And why don't you do it all in perl?

I tried it but failed .

Invoking this awk script from perl script is not a good idea, since you can do the same within perl script. Check the pattern matching m// operator of perl. For obtaining / printing values of individual columns, check the split function.

this is an equivalent Perl script converted from awk

while (<>) {
    ($f1,$f2,$f3,$f4,$f5) = split(' ', $_);
    if ($f2 =~ /JJ/ && $f4 =~ /IN/) {
        print $f2, $f3, $f4, $f5;
    }
}

Collegues
Thank you for the kind reply and solutions.

Jaganadh.G
Linguist