正则表达式蛮好用的:- #!/usr/bin/perl
- use strict;
- use warnings;
- $"=",";
- while(<DATA>) {
- my @num=split m/-|\+/;
- print "@num\n";
- }
- __DATA__
- d_q 973-c_j 314+y_d 356+i_p 638-u_m 2
- 04+w_a 588+j_c 829-p_t 599+j_v 803-p_y 92-r_h 677+h_i 341+h_
- q 705-r_f 601-m_s 822+q_q 17-w_y 720+s_d 325-d_n 559-l_s 109
- +l_v 160-x_b 232-u_r 282-v_l 521+p_o 403-x_n 613+t_x 185-g_v
- 678+z_n 753+j_k 779-o_f 283-h_w 390-z_o 772-w_v 252-a_e 51-
- m_t 945-k_q 444-r_m 233-p_w 744+k_k 136-w_k 131-s_o 163+k_i
- 733+w_c 733+g_l 42+o_i 515+x_h 130-n_b 200+i_u 25+z_i 730
复制代码
|