in reply to String replace - Part II
Is this the kind of thing you are looking for?
#!/usr/bin/perl -l # http://perlmonks.org/?node_id=1172291 use strict; use warnings; my @array = <DATA>; print @array; /^\w/ ? s/"(.*?)"/"type 1 - $1"/g : /^#/ ? s/"(.*?)"/"type 2 - $1"/g : s/"(.*?)"/"type 3 - $1"/g for @array; print @array; __DATA__ func1(parameter1,"ok...", var1) #define "this is my name" "hi" anotherfunc(foo) "string in quotes" #define "more" #define "still more" morefuncs("foo", bar, "baz")
|
|---|