Many configuration files contain many comments, including commented- out default configuration directives. Write a program to remove these com- ments from a configuration file.

What will be an ideal response?

$ cat config-squish.pl
#!/usr/bin/perl
use warnings;
use strict;
while ( <> ) {
# Strip the trailing newline
chomp;
# Skip any lines that begin with a comment,
# potentially after leading whitespace
next if /^\s*#/;
# Strip any trailing whitespace
s/\s+$//;
# If there is at least one character left on
# the line, print it
print "$_\n" if /./;
}

Computer Science & Information Technology

You might also like to view...

____ stores screen images as they are processed but before they are displayed.

A. A sound card B. Video memory C. A graphics card D. A computer

Computer Science & Information Technology

In the accompanying figure, which item is pointing to the diamond icon?

A. 1 B. 2 C. 3 D. none of the above

Computer Science & Information Technology