qscan.pl -- Scan for Excessively Long Quoted Strings (new version)


Like 40scan.pl, this program scans a text file or program for double-quoted strings, but adds scanning for single-quoted strings. If found, it reports those which are longer than a defined number of characters. The default is 40 characters, but qscan lets you define other string lengths to search for on the command line. Originally written to ensure SAS and SPSS variable labels were within the length limitations of the language. qscan can be used for checking a variety of quoted string lengths. Get all labels fixed without rerunning SAS repeatedly!

Usage

Assuming this program is executable, its commandline is: qscan [-l#] [filename...]
where:

An example run is shown below.

> qscan test.txt

   Page  1

   qscan: Find long quoted text
   by Kent Nassen, v1.9, 9/16/25
   Scanning for quoted text longer than 40 characters in the file testulc.txt

             Quote
   Line#     Length                   Line Contents/*** Message
  -------   --------  ----------------------------------------------------------
        4        42   v4 "This is a longer label for the variable v4"
        5        61   v5 "This is a very long label for the fourth variable w...
        6        70   v6 'This is a single-quoted label for the fifth variabl...

    There were 8 lines in 'testulc.txt'
    3 lines had quoted text over 40 characters long.
    The length of the longest quoted text found was 70 characters at line 6.


Back to Kent's Perl Page

Last Modified: Sun Sep 28 16:16:59 EDT 2025