I learned by editing an Irc bot plus searching for whatever specific thing I was trying to do. Eventually I built up enough knowledge to start writing my own stuff.
I'm not really the book learning type since I get bored with not doing and being directed to very specific tasks.