A good pattern includes everything you need to match the interesting data but also enough information to exclude the uninteresting data. Since you want only the lines with lnx86, make that part of your pattern. I've written this with the /x to spread out the pattern to make it easier to grok:
while( <DATA> ) {
next unless m|
/
( [A-Z]{3} \d{2} \.\d{2} \.\d{3} ) # $1
/
lnx86
(?: / | \Z ) # another slash or end of string
|x;
print;
}
__END__
BC_ROOT|/home/test/test_1/ABC/ABC-012/ABC04.16.103/lnx86
DEF_ROOT|/home/test/test_2/DEF/DEF192/DEF19.20.100/lnx86
GHI_ROOT|/home/test/test_3/GHI/GHI19.10.199/lnx86/tools.lnx86
JKL_ROOT|/home/test/test_4/JKL/JKL19.00.000/lnx86
ABC_ROOT|/home/test/test_1/ABC/ABC-012/ABC04.16.103/lnppc
DEF_ROOT|/home/test/test_2/DEF/DEF192/DEF19.20.100/lnppc
This selects the lines that you want:
BC_ROOT|/home/test/test_1/ABC/ABC-012/ABC04.16.103/lnx86
DEF_ROOT|/home/test/test_2/DEF/DEF192/DEF19.20.100/lnx86
GHI_ROOT|/home/test/test_3/GHI/GHI19.10.199/lnx86/tools.lnx86
JKL_ROOT|/home/test/test_4/JKL/JKL19.00.000/lnx86
You can generalize this a bit so you can choose a different tool later. Use quotemeta to ensure that nothing in the value is a regex meta-character (unless that's what you want):
my $tool = quotemeta( 'lnx86' );
while( <DATA> ) {
next unless m|
/
( [A-Z]{3} \d{2} \.\d{2} \.\d{3} ) # $1
/
$tool
(?: / | \Z ) # another slash or end of string
|x;
print;
}