As a side note, when you see duplicated code, it's time to refactor it. For example, you are prompting for, and reading, the user's responses, but you do this several times in a row. It looks like it's time for a subroutine.
my $fileext = prompt("\nEnter extension of files to look in (example: log or t +xt):\n"); my $playertofind = prompt("\nEnter exact name of player to find and replace:\n"); my $newplayer = prompt("\nEnter exact name of player to replace $playertofind wi +th:\n"); sub prompt { my $message = shift; print $message; chomp ( my $response = <STDIN> ); print "\nConfirmed: $response\n\n"; return $response; }
Remember: no duplicate code :)
Cheers,
Ovid
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.
In reply to Re: Simple file editing problems2
by Ovid
in thread Simple file editing problems2
by alpal
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |