I am trying to read from a file that gets written after users input their information. Some users press enter to seperate their comments into paragraphs so I can't really use the "$_" to get the data back properly or even asigning it to an array. Atleast not a way I know yet. I have delimited it using "\t::\t". Is there a way I can retrieve these type of files so I can output them into tables?
Here's the attempt that works if no one uses the "enter" button.
open (FILE, "<$item") or nonexist();
@file = <FILE>;
close (FILE);
into_table($file[2], $file[0], $file[3], $file[9]);
The one below is what I am trying to get working but so far no luck.
open (FILE, "<$item" ) or die "Not opening file: $!";
while (<FILE>) {
($uname, $categ, $title, $locat, $desc, $ship, $paym, $pic,
$price, $itnum)=split /\t::\t/;
Note: There are 3 comments by the same person, split by \t::\t and each is stored in a seperate file.
Thanks in advance...JayBee
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.