|
using Variable in grep in perl
Hi
I have a situation where i have a file with values in that, Something like below.
12345
67890
35790
I have a variable "$ELEMENT" holding these values, Now i need pass these variable values in grep statement to get messages having these numbers from one file(text1.dat) and create new one(text2.dat).
Below is my grep statement in perl.
system("grep -h \"$ELEMENT\" text1.dat >> test2.dat");
I know the grep statement in not true, Because i cannot pass variable there. I am not sure how to use variable in grep in perl code.Any suggestions??
Thanks
K.
|