I learned how to program during my PhD, shortly after changing to Linux, by poking into the source of the programs I used.
I mostly program in Octave and C++ for image processing, Python for hardware control and creating user interface, and perl for bioinformatics.
For full disclosure, I am an Octave developer and maintainer of Octave's image package.