Perl - How to print a "carriage return" to an output file?

  • Thread starter Thread starter ageoftvb
  • Start date Start date
A

ageoftvb

Guest
Let's say I want to write a program that run these 4 UNIX commands and redirect output to a file.

#!/usr/local/bin/perl
use strict;

`cd \$HOME > output.txt`;
`cut -f1 inputfile.txt >> output.txt`;
`hostname >> output.txt`;
`ifconfig >> output.txt`;

I want to print a "carriage return" or "---------" after each command to separate them and pretty up the output.txt. How would I do that?
 
open OUT, '>>', 'output.txt' or die;
print OUT qq{-------------\n} or warn;
close OUT or warn;
 
Back
Top