in reply to split problem...
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: split problem...
by ysth (Canon) on Sep 27, 2004 at 06:50 UTC | |
by tachyon (Chancellor) on Sep 27, 2004 at 06:59 UTC |