in reply to add double quotes to a perl variable
I would suggest using quotemeta(), as your strings are just labels anyway:
Or simply:#! /usr/bin/perl -l while (<>) { chomp; print '"'.quotemeta.'"' if /^[\$\w]+$/; }
#! /usr/bin/perl -ln print '"'.quotemeta.'"' if /^[\$\w]+$/;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: add double quotes to a perl variable
by tobyink (Canon) on Nov 16, 2013 at 18:57 UTC |