Hi, I am trying to run the program below:
#Perl program # Variable to get the command line arguments # Command line arguments are Source and Destination filename $src_filename = $ARGV[0]; $var_filename = $ARGV[1]; $tgt_filename = $ARGV[2]; $mac_filename = $ARGV[2]; # Statement to read data in Source file using file handler # Declaring the file handlers to read the input file open(IFILE,"<$src_filename") || die "error in opening source file\n"; open(OFILE2,"+>$tgt_filename") || die "error in opening dest file\n"; open(OFILE1,"+>$var_filename") || die "error in opening dest file\n"; open(OFILE,"<$mac_filename") || die "error in opening macro file\n"; # Read input file into a input array to process the data @Read_Array = (); # Array initialization @Read_Array = <IFILE>; # Read all contents of file into a +n array @Var_File_Array = (); # Output array for modified assmeb +ler code @Tgt_File_Array = (); # Temporary variables $Line = ''; $Indx = 0; # Variable for array indexes # Read Array print @Read_Array; # Preprocessing for each line in an array foreach $Line (@Read_Array) { #Read only 1 - 72 columns data $Line =~ /.{72}/; $Line = $&; $Line = $Line."\n"; #$Line =~ /(.+)*\s+(.+)$/; $Temp = $Line; #Remove evrything after column 40 fromt he code $Line =~ /.{40}/; $description = $'; $Line = $&; chomp($description); $description =~s/\s+$//g; $Line =~s/\(/\'/g; $Line =~s/\)/\'/g; if($Line =~/([^\s]+)\s+(DC|DS|EQU)\s+(A|X|C|H|F|D|0X|0D|0C)+(L)* +([^\'\(\s]+)*(\'(.+)\')*\s*/i) { $Print_Line = " "; $Print_Line = $1.",".$3.",".$5.",".$7.",".$description."\n"; push(@Var_File_Array,$Print_Line); } else { if($Temp!~/^\s*\*/ and $Temp!~/^\s+$/) #lines other than comment +s and line spaces { push(@Tgt_File_Array,$Temp); if($Temp=~/\s+(EQU)\s+(\*)/i) #remove EQU * from the state +ments { $Temp = $`; $Temp = $Temp."\n"; pop @Tgt_File_Array; push(@Tgt_File_Array,$Temp); if(length($Temp)>1) { @split_words = split(' ',$Temp); #to remove line co +mments #pop @Tgt_File_Array; push(@Tgt_File_Array,@split_words[0],' ',@split_words[1]); } } } } }

here when i give my input as :

VOR#000 EQU * MVC A,B move B to A CLC VAR1,VAR2 compare VAR2 != VAR1 BNE COMP EJECT
my expected output should be :
VOR#000 MVC A,B CLC VAR1,VAR2 BNE COMP EJECT
but..here i am facing some issues with removing the line comments and i need to append "BNE COMP" along with the previous line...i am very new to perl...can you please help me out to resolve this issue?

In reply to please help me to resolve the Line comments and appending issue by suno

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.