You are making an easy task look hard. It isn't. Try this:

while(<DATA>) { s/\s+$//; # trim off any \015 chars on EOL my ($Num, $Qt, $_trashit) = split /\^/, $_; print "$Num || $Qt || $_trashit\n"; # blah } __DATA__ 22009^1^52.90 22010^1^42.90 22011^1^32.90

Just replace DATA with the database filehandle.

Now the split on ^ will work so if it *apparently does not* it is because your data is not what you think it is. Your debugging code is not adequate as you want to really want to look at the data you are trying to process (ie the line) as well. You can save typing effort simply by using warn ie warn "Got ($line)\n". If you want it in a file just do ./script.pl 2>debug.log to redirect STDERR to a file.

cheers

tachyon


In reply to Re: split problem... by tachyon
in thread split problem... by powerhouse

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.