I have been trying to create a fixed length “Name and Address” file made up of fixed fields. (Typically an old fashion mainframe file) and the input data is via the keyboard. For this example only the name fields maybe between 1 and 15 characters long only and if a longer input stream is entered then it is to be truncated
I do not know how to put the CSV field delimiter in and I not sure if there is anything special when writing this type of record as I haven’t got that far.
I've just got lost
################################################## ##
#!/usr/bin/perl
# Enter Given Name
A05010:
print "Enter Given Name (Maximum 15 Characters),\n";
open ($Customer=<STDIN>);
@Customer=/(.{15})/g;
print $Customer pack("$Customer15", $Customer);
print 'is this correct?';
print "\n";
print 'enter Y or N';
print "\n";
chomp ($Reply = <STDIN>);
goto A05010 if ($Reply eq "N" or $Reply eq "n");
################################################## #
# SHOW ME WHAT HAPPENED
################################################## #
print "\n";
print '$Customer = ', $Customer;
print "\n";
################################################## #
# Enter Family Name
A05020:
print " Enter Family Name (Maximum 15 Characters),\n";
open ($Customer=<STDIN>);
@Customer=/(.{15})/g;
print $Customer pack("$Customer15", $Customer);
print 'is this correct?';
print "\n";
print 'enter Y or N';
print "\n";
chomp ($Reply = <STDIN>);
goto A05020 if ($Reply eq "N" or $Reply eq "n");
################################################## #
# SHOW ME WHAT HAPPENED
################################################## #
print '$Customer = ', $Customer;
print "\n";