in reply to Concatenate every 5 lines of input with a comma.
Did you already check perlvar?
Look for $. and $\.
But I wonder how you produce values separated with ; (semicolon), when you used , (comma) in your code? ;))
Update: example added:
#!/usr/bin/perl # vi:ts=4 sw=4 et: use strict; use warnings; while ( <DATA> ) { chomp; local $\ = $. % 5 ? ";" : "\n"; print; } __DATA__ 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Concatenate every 5 lines of input with a comma.
by ikegami (Patriarch) on Jul 09, 2009 at 19:34 UTC |