Although not busy with what I want to be busy with, not until a few minutes ago.
I've thrown the code in, and it doesn't work (shock!) so now I set to the task of debugging the shit out of it.
sub insert_cards {
foreach $newcard (@newcards) {
$newcardname = $newcard =~ /^.+?:/;
foreach $card (@cards) {
$cardname = $card =~ /^.+?:/;
if ($newcardname eq $cardname) {
$newstock = $newcard =~ /:.+?:/;
$stock = $card =~ /:.+?:/;
$stock = $stock + $newstock;
$card =~ s/:.+?:/:$stock:/;
}
@cards = (@cards, $newcard);
}
}
}
By the time it gets here, @newcards has a list of all the cards that are going into the file, and @cards has a list that's already in there. The format is
name:stock:shown
I know - why should you care?
You shouldn't.
Consider it a puzzle if you're bored. Don't tell me the answer - I'll get it eventually, and I need to figure it out myself.
That, plus, it's thought documentation for me (and pretty sloppy thought, really.)
Hopefully working through the night will get this thing fixed (finally!)