in reply to wpa and wpa2-psk
You haven't given us much to go on. You might like to consider the following steps:
- Figure out what operating system you are using.
- Manually perform the steps to connect to your wireless network.
- Perform some searches into code available. I found 2 modules on CPAN with a search on "WPA", for example.
- Convert those steps into a script.
- Come back should you have specific problems to solve.
Sane operating systems tend to come with scripts suitable to connect to networks, needing only some editing of a configuration file. I suspect Windows would be harder to script, but maybe some work with Win32::OLE or indeed PowerShell might do the trick.
Also look at How (Not) To Ask A Question.