All pastes #207285 Raw Edit

Unnamed

public text v1 · immutable
#207285 ·published 2006-10-17 22:47 UTC
rendered paste body
#!/usr/bin/perl -w
use strict;

print "Please enter a filename to receive input from: \n";
chomp ( my $input_file = <STDIN>);

print "Now another file you would like output to go to: \n";
chomp ( my $output_file = <STDIN>);

menu {
                print    " ***********************\n" .
                         " * 1. Replace word.    *\n" .
                         " * 2. Replace string.  *\n" .
                         " * 3. Sort lines.      *\n" .
                         " * 4. Count words.     *\n" .
                         " * 5. Quit             *\n" .
                         " ***********************\n\n" .
                         "Enter a choice: ";
                chomp(my $choice = <STDIN>);



SWITCH: {
        if($choice == 1) { replaceWord(); last SWITCH; }
        if($choice == 2) { replaceString(); last SWITCH; }
        if($choice == 3) { sortLines(); last SWITCH; }
        if($choice == 4) { countWords(); last SWITCH; }
        if($choice == 5) { die "Good bye!\n"; last SWITCH; }
        print "\nInvalid choice: $choice...\n\n";
        }
}

sub replaceWord { ()
}