in reply to help declaring variables within perl one-liner
Backticks interpolate, so you need to escape the dollars and backslashes:
#!/usr/bin/perl -w use strict; my $num_subs = `perl -w -0777 -pi -e 'my \$c=s/foo/bar/g;print STDOUT +"\$c\\n"' ./foo_test`; printf("num_subs = $num_subs\n");
🦛
|
|---|