Article wrapper

1#!/usr/bin/perl -- # --*-Perl-*--
 
use Getopt::Std;
 
5$usage = "Usage: $0 [-q] [-u|-p|-m] file [ file ... ]\n";
 
die $usage if ! getopts('qupm');
 
die $usage if ($opt_p + $opt_u + $opt_m) != 1;
10 
$file = shift @ARGV || die $usage;
 
$opt = '-u' if $opt_u;
$opt = '-p' if $opt_p;
15$opt = '-m' if $opt_m;

This paragraph interrupts the listing. The line numbering continues in the following listing.

16while ($file) {
    print "Converting $file to $opt linebreaks.\n" if !$opt_q;
    open (F, "$file");
    binmode F;
20    read (F, $_, -s $file);
    close (F);
 
    s/\r\n/\n/sg;
    s/\r/\n/sg;
25 
    if ($opt eq '-p') {
	s/\n/\r\n/sg;
    } elsif ($opt eq '-m') {
	s/\n/\r/sg;
30    }
 
    open (F, ">$file");
    binmode F;
    print F $_;
35    close (F);
 
    $file = shift @ARGV;
}