i am new with perl just trying my hand with perl for some project where i need to connect to DATABASE MYSQL. DBMS1.pl is working fine when i am passing VALUE through parameter. My program "DBMS2.pl" is throwing exception as "Error: Access denied for user 'root". in this i am accepting value from user.

Congratulations on fixing your script. However, I can suggest a few improvements.

Always (Yes ALWAYS) use strict. In the extremely rare cases where you must not have it, turn it off in the smallest possible scope. It does require some effort to declare all your variables (usually with my), but it will prevent many hard-to-find errors.

There is a subtle difference between <> and <STDIN>. Use the latter only when you are certain that you need it.

You are using the default value (space) of the special variable $" in your statement

Code

print "@row\n";

If you define $" in you code, you will not be confused by those spaces the next time you have to modify your code.

There is some advantage in using a module to prompt for username and password. Not all prompt modules are available on all platforms. None of the modules have all the features you might want. Look for a module that sets a default, validates the input, allows the user to fix any errors (or optionally abort), hides the password while the user is typing, and gets rid of the newline for you. Good Luck, Bill