Thursday, March 6, 2008

Making Hash Brownies

I started learning perl a few days ago on a tight deadline (I signed up for an online course than ends with a test March 7th, and then slothfully ignored the class until March 3rd). The class consists of reading webpages and doing assignments and until today I had the better of it, but now it's got the better of me with sort subroutines, bundled together in a lesson about hashes. I'm having trouble grokking what argument sort passes to its inline subroutines (are they really just called $a and $b?)* but hashes were bundled with the lesson and I understand hashes very well.

So I'm making commemorative hash brownies:

%brownies = ("butter" => "50 grams",

"baking chocolate" => "200 grams",

"brown sugar" => "200 grams",

"medium eggs" => "3",

"flour" => "75 grams",

"nutmeg" => "pinch",

cinnamon => "pinch",

vanilla => "2 tablespoons");


*Don't point me at documentation. I've spent all day reading perl docs. See if you can explain it in your own words, 5th grade style.

----

Breaking News: It turns out that sort does pass it's arguments to subroutines in $a and $b instead of in the @_ array.

No comments: