in reply to passing data to other script via link

Don't pass the SQL queries that way, it's dangerous (as someone else already pointed out).

I would suggest you call your script with something like this:

And, in your program you can have:

my $q = new CGI; SWTC: { $q->param('task') eq 'dsp' and do { dsp() last SWTC; }; $q->param('task') eq 'other' and do { other() last SWTC; }; };

You can then keep all the queries in the subs.

Hope this helps!