1.every value should end with '/'
2. should be enclosed within quotes ""
3. Should have comma ',' at end
See the concatenation operator '.' in perlop, Additive Operators, and substr.
Read perlop. All of it.
I want to maintain the same exisitng format in @exclpaths array
The format in your @exclpaths is its representation in code. Inside the array, the strings are not enclosed within double quotes, and they don't have a comma at the end:
my @exclpaths = (
"wefwfewf/fewfff/",
"btrtbrtb/gbrgbrg/rttty/",
);
print $_,"\n" for @exclpaths;
__END__
wefwfewf/fewfff/
btrtbrtb/gbrgbrg/rttty/
If you want decorations, just add them:
my @exclpaths = (
"wefwfewf/fewfff/",
"btrtbrtb/gbrgbrg/rttty/",
);
print "\"$_\",\n" for @exclpaths;
__END__
"wefwfewf/fewfff/",
"btrtbrtb/gbrgbrg/rttty/",
perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'
|