Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: wrap contents of an array in single quotes separated by comma

by Discipulus (Canon)
on Feb 21, 2015 at 22:13 UTC ( [id://1117447]=note: print w/replies, xml ) Need Help??


in reply to wrap contents of an array in single quotes separated by comma

This is almost a oneliner task, and note that mine is not an elegant solution
win>perl -lne "push @arr, $_; END{print join ',', map{'\''.$_.'\'' } +@arr }" trash.txt #untested, only different quotation. linux>perl -lne 'push @arr, $_; END{print join ",", map{"'".$_."'" } +@arr }' trash.txt

HtH
L*
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1117447]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2024-04-23 06:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found