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");
🦛
In reply to Re: help declaring variables within perl one-liner
by hippo
in thread help declaring variables within perl one-liner
by Special_K
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |