why are you now delimiting (or trying to split) records on a
$<TAB><TAB><NEWLINE>
not even sure that that's what's it's trying to split on, as you've got quotes in the wrong places there "...
$/ = qq{"\$"\t""\t""\n};..."
To cut to the chase: the program was trying to slurp the whole file, as it couldn't find the record delimiter, and was trying real hard to do so.
Here's a simple solution...please provide a proper sequence of characters for the regex to look for to find the end of each record, if it's not the original "$" (dollar sign on a line by itself)
while($line=<>) {
chomp $line;
if($line =~ /^\$$/) { #look for start of line, followed by a lite
+ral dollar sign, followed by the end of the line (not newline charact
+er, but $ has to be at the end of $line)
close OUTFILE;
undef $data;
next;
}
if(!$data) {
open(OUTFILE,">$line") or die;
} else {
$data = 1;
print OUTFILE "$line\n";
}
}
this is nice and simple (procedural style coding) that you will find easier to understand. run the script "perl script.pl <your_data_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.