40scan.pl -- Scan for Excessively Long Quoted Strings


This Perl program to reads through a text file looking for double quoted strings and reports those which are longer than a defined number of characters (default=40). The output consists of the line number of the long quote, the length of the quoted text, the actual line containing the quoted text, and at the end of the run a summary of the number of lines with excessive length, the number of lines in the file, and the location and length of the longest quote.

Usage

Assuming this program is executable, its commandline is: 40scan.pl infile
where:

An example run is shown below.

~> 40scan.pl test.txt

   Page  1

   40scan: Find quotes longer than 40 characters
   by Kent Nassen, v1.5, 9/22/98
   Scanning for long quoted text in the file:  test.txt

   Line#     Length                             Line Contents
  -------   --------  --------------------------------------------------------------
        7      42     v3 "This is a longer label for the variable v3"
        8      61     v4 "This is a very long label for the fourth variable which is v4"

    2 lines had quoted text over 40 characters long.
    There were 8 lines in the file.
    The length of the longest quoted text found was 61 characters at line 8.

Remaining to do are allowing the user to select the width to scan for on the command line and scanning for single-quoted strings.


Back to Kent's Perl Page

Last Modified: Tue Jul 15 13:42:04 EDT 2025