use vars qw($spaces); my $spaces = " " x shift; while (<>) { s/\t/$spaces/g; # Tabs to spaces. # Perform substitution the other way # for spaces to tabs. print; } #