# this programs prompts a user for a filename and then
# replaces all tabs in that file with 3 spaces.
print "\nWhat file do you want to 'detabify'? ";
my $file = <>;
chomp $file;
# set the input record separator so that <> reads the entire file at o
+nce
local $/ = undef;
open FILE, "< $file" or die "error reading $file - $!";
my $text = <FILE>; # the entire file contents
close FILE;
$text =~ s/\t/ /g; # replace each tab with three spaces
open FILE, "> $file" or die "error writing $file - $!";
print $text;
close FILE;