#! /usr/bin/perl # This Perl script buffs (removes trailing blanks from) and/or expands # (converts tabs to spaces in) the files named on the command line. It # also ensures that each file (if not empty) ends in a proper "\n". use warnings; use strict; use integer; our $tab = 8; our $pat_makefile_name = qr/Makefile|rules/; our $usage = <; close FILE; my $has_acted = 0; my @buff_expanded = buff_expand $is_makefile, $has_acted, @line; if ( $stdout ) { print @buff_expanded; } elsif ( $has_acted ) { open FILE, '>', $file or warn( "$0: cannot write $file\n" ), next; print FILE @buff_expanded; close FILE; } } } else { my @line = <>; my $has_acted = 0; print buff_expand 0, $has_acted, @line; }