Iam sorry if my first post confused a bit...
Ok here is what iam doing...
** COBOL Program which extracts information from database to flat file with ! as delimiter...
** My perl programs reads the flat file and should convert it to CSV file based on value at Col 17( contains clients names)
** one CSV file per client
my %filehash = ();
while (<>){
@pline = split (/\!/,$_);
my $keycolumn = $pline[15]; # based on this col values split files
unless ($filehash{$keycolumn}){
$filehash{$keycolumn}{name} = $pline[15];
open $filehash{$keycolumn}{handle},">$filehash{$keycolumn}{n
+ame}; # open distinct file handles for each distinct value found in c
+ol 15
}
print {$filehash{$keycolumn}{handle}} @pline;
}
# In the above code iam considering all col's , but my new requirement
+ is , for some rows i should only some predifined col's which can 1,
+3,5,6,7 i.e. i need slice these indices from @pline before writing it
+ into corresponding file
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.