Perl oneliner – converting several lines to a comma-separated list
Sometimes I have a list of something in a file, one line per item and want to convert it to a comma(collon,…)-separated line (with no trailing separator of course) that can be used as a command-line parameter to some other tool. A perl oneliner comes in handy:
`perl -e '@_=<STDIN>; chomp(@_); print join(";",@_);' < data_file`