use strict; use warnings; my @pairs = ( ['WORKING -STORAGE SECTION.', 'declare'], ['PROGRAM -BEGIN.', 'begin;'], ['^DISPLAY', 'PUT'], ['^ACCEPT', 'GET'], ['PROGRAM -DONE.', 'END;'], ); open sourcefile, '<', "source.cbl" or die "Can't open: $!"; open targetfile, '>', "source.ada" or die "Can't open: $!"; while (defined (my $line = )) { $line =~ s/$_-[0]/$_->[1]/ for @pairs; print targetfile $line; }