I am reading some parameters (from user input) from a .txt
file and want to make sure that my script could read it even a space or tab is left before that particular parameter by user.
Also if I want to add a comment for each parameter followed by # , after the parameter (e.g 7870 # this is default port number
) to let the user know about the parameter
How can I achieve it in same file?
Right now, I am using split /\|\s/
.
Code:
$data_file="config.txt";
open(RAK, $data_file)|| die("Could not open file!");
@raw_data=<RAK>;
@Ftp_Server =split(/\|\s/,$raw_data[32]);
config.txt (user input file)
PING_TTL | 1 CLIENT_PORT | 7870 FTP_SERVER | 192.162.522.222
Could any body suggest me a robust way to do it?
/rocky