BjornStenborg has asked for the wisdom of the Perl Monks concerning the following question:
Hi. I have a simple question which probably has a simple answer as well.
I'm fetching the output from a shell command using backticks, but the command argument is too long to prettily fit on one line of my Perl script. How can I conveniently break it into multiple lines?
As a workaround, I can do this:
However, that's two commands - I'd like to do it in one. I could do this:$query = "command argumentpart1" . "argumentpart2"; $result = `$query`;
But that breaks the indentation! (Assume that spaces are not allowed between argumentpart1 and argumentpart2).$result = `command argumentpart1\\ argumentpart2`;
Perhaps I could build something using string concatenation in the shell, but that's pretty ugly. I assume there is some neat way to solve this that I just haven't been able to figure out.
Grateful for ideas.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Line breaks within backticks
by Arunbear (Prior) on May 08, 2008 at 11:23 UTC | |
by BjornStenborg (Initiate) on May 08, 2008 at 12:37 UTC | |
|
Re: Line breaks within backticks
by casiano (Pilgrim) on May 08, 2008 at 11:12 UTC | |
by ikegami (Patriarch) on May 08, 2008 at 12:29 UTC | |
by BjornStenborg (Initiate) on May 08, 2008 at 12:41 UTC | |
|
Re: Line breaks within backticks
by rovf (Priest) on May 09, 2008 at 10:04 UTC |