Hi I am working on the sub below.
The aim is to create a string from values passed to the sub-routine and then use that as a if criterion for the push operation. Is this possible? sub get_list { my ($black_list,$table,$crit)[EMAIL PROTECTED]; ### $crit is a hash reference containing key to search and search expression, for example start=Jul 07 ### my $listings; #### This is a loop through hash containing key, value pairs of field, value and placing into an array #### foreach my $keys (keys %{$crit}){ push @crit,'{'."'".$keys."'".'}=~'.$crit->{$keys}; } my $crit1=join ' and ',@crit; ### array to string ### ### This is the record definition from a master hash ### ###loop start ### 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'}] ### here I want an if statement to run that is generated depending on what keys are in the oringinal %crit hash. Number of arguments variable ### if $crit1; # this is the problem rather than searching on the value of $guide{$guides}-> it prints it out as a literal } #### loop end ### } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/