in reply to why does it not work???
foreach $keye (@key_en) { $linb=`cat /home/vikash/pro_1/en_1000 | grep --regexp '$keye'`; print "$linb\n"; }
and
foreach (@key_en) { $linb=`cat /home/vikash/pro_1/en_1000 | grep --regexp '$_'`; print "$linb\n"; }
are functionally equivalent. Why do you think it doesn't work?
1 more thing i had to ask is how many $_ variables can be used simultaneously and how.
There can only be one variable of any name at a given location in a script, so there is only one variable named $_.
As a side note, there is no reason to pipe cat into grep. You can save characters and possible confusion by writing that as
$linb=`grep --regexp '$keye' /home/vikash/pro_1/en_1000`;
|
|---|