Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

chaoticset (2105)

  (email not shown publicly)
AOL IM: chaoticset23 (Add Buddy, Send Message)
Yahoo! ID: illuminatus_foil (Add User, Send Message)

JAPH. (That's right -- I'm not Really Inexperienced any more.)

I'm not just here, I'm here [], and here [] too, I ramble randomly in my philosophical blog [] and my other blog []. Soon I'll come in a convenient six-pack.

Journal of chaoticset (2105)

Saturday October 06, 2001
11:22 AM

The Lament Of Unilocation

[ #899 ]
Ah, if only I could be in two places at once.

I have to bring my SO lunch; I have to clean the living room; I have to finish my God Damned Program.

I think I can actually do the last one.

I'm fairly close. Everything's working fine; the thing that removes the AE symbol and replaces it with Ae is in place. (Although I'll admit I jury-rigged it; it just checks if the first character of the name is nonletter and replaces it with Ae. In the long run, that could come back to bite my ass.) It inserts the names into the list peachy keen. Just have to fix duplicates and get it to write the new inventory file now.

Duplicates are actually going to be easier than I thought. There should never be a case where more than one duplicate exists, and there shouldn't be duplicates in the new list, so I just have to foreach element in @newcards and then foreach element in @cards, check if their names match, and if they do, add their stock amounts and write the new line to the @cards.

The problem then: How do I remove the existing line with the previous inventory info?

Answer: I don't. I don't make a new line; I add the values and then replace whatever is between two colons (because there's just the one value between two colons in that array) with the new value. Easy as pie, and shorter in code, I'll bet. Gotta love regular expressions.

Oh, and the new Exegesis(sp?) has me convinced about learning Perl 6 eventually. I like //. I like the context operators. I like what I understand.

However, I'd like to be a LOT better with Perl 5 before I go farting around in Perl 6.