Gossamer Forum
Home : General : Perl Programming :

matching word in a list

Quote Reply
matching word in a list
i'm going crazy with something i know is simple. i have two variables:

$in{'Weekdays'} - is value from form where days of week are checked, can contain one or more days in format Monday Tuesday etc

$in{'DayOfWeek'} is calculated by a function that looks up the date and figures the day of week and returns it in same format Monday Tuesday etc

my routine goes thru a month one day at a time. if the day of the week is in the list Weekdays, it's supposed to do something. if the day of the week is not in the list Weekdays, it's supposed to just go to the next day and try again.

these are the statements i've tried:

if ( $in{'Weekdays'} =~ /$in{'DayOfWeek'}/ ) { #this doesn't get anything
if ( $in{'DayOfWeek'} =~ /$in{'Weekdays'}/ ) { #this creates every day whether wanted or not

i also tested my code that increments the date by one and it is correctly pulling the next date. so i think my if statements are the problem. please help! thanks
Quote Reply
Re: [delicia] matching word in a list In reply to
never mind. i figured it out.