Creating re from computed values



I am trying to create a regular expression for an if statement from
computed values passed to the sub-routine as follows

sub get_list {
my ($black_list,$table,$crit)= _;

# $crit is a hash reference containing key to search and search expression
my $listings;

my @crit='$guide{$guides}->{'."'".'del'."'".'}!~1' ; # common criteria
for all calls to function
foreach my $keys (keys %{$crit}){
push @crit,'{'."'".$keys."'".'}=~'.$crit->{$keys};
}
my $crit1=join ' or ',@crit;



foreach my $guides (sort {$guide{$a}->{'start'} <=>
$guide{$b}->{'start'}} keys %guide){
push 
@{$listings},[$guide{$guides}->{'id'},$guide{$guides}->{'Channel'},substr($guide{$guides}->{'start1'},0,16),$guide{$guides}->{'start'},substr($guide{$guides}->{'stop1'},0,16),$guide{$guides}->{'stop'},$guide{$guides}->{'name'},$guide{$guides}->{'cat0'}]
 if $crit1;

# this is the problem rather than searching on the value of
$guide{$guides}-> it prints it out as a literal

}


$table->set_data_array($listings);
return 1
}

Is what I am trying to do possible? - ie: taking a list of fields to
seach and associated criteria and feeding this into a if statement
(the values come from lookups determined via combobox values



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]