Hello, PerlMonks!
I am trying to write a script that will merge text files into CSV (comma delimiter.)
FILE A: List of names separated by newline(\b)
FILE B: List of grades separated by newline(\b)
FILE A:
DAVID KIM
CHARLIE DOE
AARON PITTS
FILE B:
94
75
87
The script will create FILE C looks like below:
DAVID KIM,94
CHARLIE DOE,75
AARON PITTS,87
So far I have
use warnings;
use strict;
use utf8;
local $/ = undef;
open FILE1, "myfile" or die "Couldn't open file: $!";
binmode FILE1;
$string1 = <FILE1>;
close FILE1;
open FILE2, "myfile" or die "Couldn't open file: $!";
binmode FILE2;
$string2 = <FILE2>;
close FILE2;
#and I got stuck here. I am thinking using "for" syntax, couldn't find
+ details. but can anybody help me?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.