Global vars are valid in the function that they are declared in. If the variable is in the top level of the script and you declare it a global in the function then it will still exist in the top level when you come back out of the function - see my previous example of globals.
As for the keyboard, if you have an ASDA near you they used to sell wired keyboards for £4. Not sure if they still do anymore, mine doesn't but still does the mice but their basic KB is now £7 iirc. Every store seems to vary though. I wouldn't bother with Tesco.. and I don't think Morrisons sell tech bits at all. I don't think Sainsburys sell anything useful unless its one of their larger stores.