in reply to Re: Line breaks within backticks
in thread Line breaks within backticks
Better yet, use the multiple argument form to avoid (lack of) escaping problems and to simplify the code.
my @cmd = ( 'ls', '-l', 'file1', 'file2', 'file with space', ); my $results = do { open(my $fh, '-|', @cmd) or die("Unable to run $cmd[0]: $!\n"); local $/; <$fh> };
PS - Why did you use and there instead of making two statements?!
Update: Fixed wrong variable name.
|
|---|