Formatting Captured Shell Output
Just being picky, this will print all of the output lines on a single line separated by spaces. Since you probably want to see them on separate lines, you could either:
Method 1: Retain Original Newlines (Do Not Chomp)
my @files = qx(ls);
print @files;
Method 2: Chomp and Append Newlines on Output
chomp(my @files = qx(ls));
print "$_\n" foreach @files;
No comments:
Post a Comment