Separate the variables with commas to put multiple data fields on the same line : Variable « Report « Perl






Separate the variables with commas to put multiple data fields on the same line

   
#!/usr/bin/perl -w

format WORKORDER=
itemB: @<<<<<<<<<<<<<<<<<<<<   itemC: @>>>>>>>>
$itemB, $itemC
itemA: @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$itemA
Access:      @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$access
Deck: @<<    Stardate: @########.#
$deck, $stardate

.



# Open file.
open(WORKORDER, ">yourFile.txt" ) or die "Can't open yourFile.txt", $!;


# Output record.
$itemA = "This is a itemA";
$itemB = "itemB";
$itemC = "Low";
$access = "no";
$deck   = 17;
$stardate = 99999.4;

write WORKORDER;


# Output record.
$itemA = "This is the second";
$itemB = "itemB 2";
$itemC = "High";
$access = "Yes";
$deck   = 12;
$stardate = 99999.5;

write WORKORDER;


# Output record.
$itemA = "This is the third.";
$itemB = "itemB 3";
$itemC = "medium";
$access = "Via Jefferies Tube";
$deck   = 10;
$stardate = 95212.0;

write WORKORDER;

# Close file.
close(WORKORDER);

   
    
    
  








Related examples in the same category

1.Passing one variable with ! inside to format
2.Prints a value-field character.
3.Put a variable in the report header
4.Passing value to the format