#!/usr/bin/perl use strict; use warnings; use DBI; use Data::Dumper; use SQL::Abstract; # Subroutine to call sub process(){ my $processed = $_[0]; return sub { if ( @_ ){ #@_ =~ s/^&//; # strip leading & - this only occurs in the 'additional field' print "recieved: @_\n"; # detect additional with multiple key value pairs. if ( index(@_,'&') >= 0 ){ print "@_ contaisn & character - so it's the additional field with multiple key value pairs"; } # detect ors if ( index(@_,'|') >= 0 ){ print "@_ contains pipe character for ORs"; } # detect wildcards if ( index(@_,'*') >= 0 ){ print "@_ contains whidcard character"; } } } } # skip the actual fetching of the data via SQL query, I have no problems with that part process->($TABNAME) if defined($TABNAME); process->($COL1) if defined($COL1); process->($ADDITIONAL) if defined($ADDITIONAL);