Hello guys i'm trying to convert a source code to another and
a friend of mine adviced me to use perl since it has powerful string
manipulation. And so am learning pearl... Could anyone be kind enough to help me
with this... When i run this there is no output saved in the target file...
Thanks!
use strict; open sourcefile, "source.cbl" or die "Can't open: $!"; open targetfile, "source.ada" or die "Can't open: $!"; foreach my $line (<sourcefile>) { if ($line =~ /WORKING -STORAGE SECTION./) { print targetfile tr/WORKING -STORAGE SECTION./declare;/; } elsif ($line =~ /PROGRAM -BEGIN./) { print targetfile tr/PROGRAM -BEGIN./begin;/; } elsif ($line =~ /^DISPLAY/) { print targetfile tr/DISPLAY/PUT/; } elsif ($line =~ /^ACCEPT/) { print targetfile tr/ACCEPT/GET/; } elsif ($line =~ /PROGRAM -DONE./) { print targetfile tr/PROGRAM -DONE./END;/; } else { print "none"; } } close sourcefile or die "Can't close: $!";
In reply to Converting a source code by oblate kramrdc
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |