I think you have the quotes a level too deep,
return `$conf | ./perl/tester.pl`;
You may be using the wrong quotes where you set $conf, but maybe not, I can't tell. You haven't described how those files are constructed and how they work together.
| [reply] [d/l] |
Several problems: First, you are assigning the output of a backtick shell command to $conf, but not testing to see if the command worked. Depending on what happens to be in your current working directory, that shell command might return an empty string. Did you happen to notice anything else on STDERR (which this initial backtick shell would produce, if those commands failed)?
(BTW, the error message you cited is caused by having an empty string to the left of the pipe symbol in a shell command.)
In any case, this next part is almost certainly not what you really want:
# changes a setting
$conf = s/99/$num/;
I think you meant to use the "=~" operator there (to alter the contents of $conf, assuming it's not empty)? As it is, when the substitution fails, $conf is be set to empty string. (It would be set to "1" on success, but that would only happen if by chance $_ contains "99").
But even with the "=~" operator there, the next part doesn't make sense: if the initial backtick command worked as intended, $conf would contain a multi-line string. If you change a 99 in that string to something else, it's still multi-line, and I expect that putting it at the start of a pipeline in another backtick shell command would be a bad idea.
(Update: added clarification in first paragraph, fixed grammar in the second; also wanted to point out that the initial backtick command (cat; ls) should probably be replaced by using perl-internal operations: open/read the file, use a file glob or readdir; this would make the error handling better.) | [reply] [d/l] |
yep got it working just needed to follow your suggestions.
I'll convert the backtick shell bit to use perl internal operations (I had it running as a shell command so it was easier this way) | [reply] |