To wire a lamp cord with an inline switch, you need to find the neutral and the hot wires. The neutral wire will have ribbed insulation. If it's hard to tell which wire is neutral or hot, use a multimeter. The hot wire goes to the brass screw on the lamp socket, the neutral wire goes to the silver screw on the lamp socket.
Check out more home improvement tips on our weekly podcast