Link to home
Start Free TrialLog in
Avatar of kopibean
kopibean

asked on

Easy!Printing to the desired output using format

I have a problem with printing the data to a file.I want the next parameter to be beside it and not at another line.
This might not seem clear to you what I want. Thus, please see at my codes,my incorrect output and my ACTUAL output.
 

My incorrect output:

Waf si XB8B_Amodul
       _R1K_R_Rmea
...................



Waf si XB8B_Amodul XB8B_Amodul
       _R1K_R_Rmea _MFA1_FETCH
...............................


Waf si XB8B_Amodul XB8B_Amodul XB8B_Amodul
       _R1K_R_Rmea _MFA1_FETCH _MFA1_FETCH
...........................................


I want the output to be as follows:

Waf si XB8B_Amodul XB8B_Amodul XB8B_Amodul
       _R1K_R_Rmea _MFA1_FETCH _MFA1_FETCH
...........................................


My codes(Please take a look):

format FILEHANDLE2 =


Waf si @<<<<<<<<<<<@<<<<<<<<<<<@<<<<<<<<<<<
      $para1,     $para2,     $para3  
       @<<<<<<<<<<<@<<<<<<<<<<<@<<<<<<<<<<<
      $para11,    $para22,    $para33  

............................................
.

open(FILEHANDLE3,"tablefile5") || die "Cannot open file";
@file3 = <FILEHANDLE3>;
foreach(@file3)
{
     if(/.*!.*!.*!.*!/)
     {
       ($str1,$str2,$str3,$str4) = split(/!/,$_);
       push(@stuff,$str1);
       $para1 = substr($stuff[0],0,11);
       $para11 = substr($stuff[0],12,11);
       $para2 = substr($stuff[1],0,11);
       $para22 = substr($stuff[1],12,11);
       $para3 = substr($stuff[2],0,11);
       $para33 = substr($stuff[2],12,11);

       write FILEHANDLE2;
     }
}

Avatar of kopibean
kopibean

ASKER

Adjusted points to 20
ASKER CERTIFIED SOLUTION
Avatar of ozo
ozo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial