in reply to appending values based on criteria
#!/usr/bin/perl # http://perlmonks.org/?node_id=1140995 use strict; use warnings; $_ = <<END; id|Name|app1|app2 1|abc|234|231| 2|xyz|123|215| 1|abc|265|321| 3|asd|213|235| END 1 while s/^(\d+\|\w+\|)\K([\d,|]+\n)(.*)^\1([\d|]+)\n/ my ($gap, @tmp) = ($3, split m{\|}, $4); $2 =~ s#(?=\|)#',' . shift @tmp#ger . $gap /mes; print;
hehehe :)
|
|---|