# In my above code, the data is concatenated as follows: abc,2,3,4,5,6 ,7,5,2,1,6,2,3 ,8,2,1,3,1,4 #But expected output is : abc,2,3,4,5,6,7,5,2,1,6,2,3,8,2,1,3,1,4
Again, we need to see the input file correctly formatted before we can say for sure what you need to do, but it seems very very likely that your problem comes from the fact that the input is split into separate lines, each of which having a trailing end-of-line character. In this case, you simply need to remove that character from your input lines immediately after you read it (although it could be done later, it is best to do it right away). Change your code as follows:
while(<FH>) chomp; { # ...
There are many other things to be said about your code, but this correction should at least solve your immediate problem. I'll wait for a correctly formatted input before making any further comments.
In reply to Re^3: Combining multiple lines based on the given condition
by Laurent_R
in thread Combining multiple lines based on the given condition
by anony
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |