in reply to Unable to find my mistake

I find it impossible to find a mistake since I have no idea what output you were expecting. But anyway: Running the command through the debugger is usually quite useful in such cases:

perl -d pqr.txt

Replies are listed 'Best First'.
Re^2: Unable to find my mistake
by suvendra123 (Initiate) on Mar 17, 2021 at 23:14 UTC
    I am getting output as
    .dgrs(dgrs_1; .dgrs(dgrs_2; .dgrs(dgrs_3; .mgs(mgs_1; .mgs(mgs_2; .mgs(mgs_3;
    But expected output should be
    dgrs_1(dgrs_1); .dgrs_2(dgrs_2); .dgrs_3(dgrs_3); .mgs_1(mgs_1); .mgs_2(mgs_2); .mgs_3(mgs_3);