I know there are easier ways to do this, but I must demonstrate removing the first seven lines of a system call (top -bn1) and write the results to a file using array slices. I currently am having trouble with the syntax of removing the seven lines, and I'm not sure how to write it to a file.
my @top_command = `top -bn1`;
@top_command = @top_command(7..@top_command);
print @top_command, $file_name;
[]), not parentheses. @array with $#array.splice operator. That should be enough to complete your assignment.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With