splitting on all kind of spaces and tabs
Posted
by rockyurock
on Stack Overflow
See other posts from Stack Overflow
or by rockyurock
Published on 2010-04-04T09:54:56Z
Indexed on
2010/04/04
10:03 UTC
Read the original article
Hit count: 205
perl
hello,
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 ?
here is wat i am using (/\|\s/)
code::
$data_file="config.txt"; open(RAK, $data_file)|| die("Could not open file!"); @raw_data=;
@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
© Stack Overflow or respective owner