programming-examples/perl/Report/Separate the variables with commas to put multiple data fields on the same line.pl

54 lines
919 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
#!/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);