programming-examples/perl/Report/Using format to save data to a file.pl
2019-11-15 12:59:38 +01:00

26 lines
460 B
Raku

#!/usr/bin/perl -w
# Usage:
# Perl format1.pl outputfile
# Set up format.
format NAMES=
Last name : @<<<<<<<<<<<<<<<<<<<<
$lastname
First name: @<<<<<<<<<<<
$firstname
.
# Note period alone on line above.
# Also note blank line before period.
open(NAMES, ">yourFile.txt" ) or die "Can't open yourFile.txt, $!";
$lastname = "AA";
$firstname = "BB";
write NAMES;
$lastname = "FF";
$firstname = "MVV";
write NAMES;
close(NAMES);