# more a
123|aaa|456
# more b
b: No such file or directory
# ./perlt
Which source file? a
What destination file? b
What search pattern: 1
What replacement strint: 1000000
# more b
100000023|aaa|456
#!/usr/local/bin/perl
sub get_line {
print $_[0];
chomp(my $line = <STDIN>;);
$line;
}
my $source = &get_line("Which source file? ");
open IN, $source
or die "Can't open '$source' for input: $!";
my $dest = &get_line("What destination file? ");
die "Won't overwrite existing file"
if -e $dest;
open OUT, ">;$dest"
or die "Can't open '$dest' for output: $!";
my $pattern = &get_line("What search pattern: ");
my $replace = &get_line("What replacement strint: ");