As part of an upcoming interview, I've been asked to create a PERL script to import a csv file and create two output files. WHY couldn't they have asked for the script to be built in SQL Plus? I've developed in SQL Plus and dabbled in other languages. I've never even seen PERL! I won't be developing in PERL...this is just a test! Part of the test is to see how I use resources to obtain the data/knowledge needed to simply get the job done - not that I even have to do it myself! So that's where you guys come in! Can you help? PLEASE???
The task I've been assigned follows:
Description:
Write a PERL script that will take read an input file in CSV format, m
+anipulate the data, and then output 2 files. The first output file w
+ill be in CSV format, and the second file will be a series of SQL ins
+ert statements for a predefined table.
Input file layout:
Subscriber TN (10 Char)
Subscriber First Name (15 Char)
Subscriber Last Name (30 Char)
Date/Time of Call Start (TimeStamp)
Date/Time of Call End (TimeStamp)
TN Subscriber Called (10 Char)
Subscriber Called in Network (1 Char) – Y or N ( Y = Subscriber in Sa
+me Network)
PERL Application:
Read each record in.
If Subscriber Network = N , output to File #1, else Output to File #2.
Calculate length of Call.
Output file #1 Layout:
Subscriber TN
Length of Call (Integer in seconds)
TN Subscriber Called
Output file #2 Layout (SQL Insert Statements):
Subscriber TN (10 Char)
Subscriber First Name (15 Char)
Subscriber Last Name (30 Char)
Length of Call (Integer in seconds)
TN Subscriber Called (10 Char)
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.