shouldnt line 12 open $text instead of $file? snowrider1: #!/usr/bin/perl 2: #this programs prompts a user for a filename and then 3: #replaces all tabs in that file with 3 spaces. 4: print "What file do you want to \"detabify?\" "; 5: $file=<>; 6: chomp $file; 7: $/=undef; #changes the input record separator so it'll +read the entire file in at once 8: open FILE, "<$file"; 9: $text=<FILE>; #reads the entire file in 10: close FILE; 11: $text=~s/\t/ /g; #replaces tabs 12: open FILE, ">$file"; 13: print $text; #write changes to file 14: close FILE;
In reply to is this correct by snowrider
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |