http://qs321.pair.com?node_id=193451

hewarn has asked for the wisdom of the Perl Monks concerning the following question:

Hi, If anyone has a elegant solution for this, please share it with me..

I am reading result a file and have already found the lines I wish to join but...this is not working....

I have names like Mary,Alan,David and I am searching for those from file. Once I have found it, I just would like to remove empty lines and attach the next written line after the word.

Original file looked like

Alan 2.13 Mary 2.16 And the new file would be: Alan 2.13 Mary 2.16
I cant seem to get that end of line off and join those lines...

Small but irritating problems cause I dont know how.

open (ROWS, "style.txt") || die "File not found"; while (defined ($rivi = <ROWS>)) { if($rivi =~ /^$names[$i]/) { chomp $rivi; $rivi=~tr/\n\n//; $rivi=~s/\n\n//; $rivi=~tr/0xb6//; $rivi=~tr/0xb6//; . . . . my $text=$text.$rivi; open (E,">>style1.txt"); print E $text; close E; }
BR Hewarn