I'm attempting to write a script that will start a logging procedure
and shut it off 15 minutes later. I've created the below, but for some
reason, I can't get the until piece of the clause to work. I get a
syntax error near "until $min". Any help would be appreciated.

my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst);
if ($input =~ m/$search_term/i){
# If a word in the channel matches the search term, then
begin logging.
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
# Timestamp the log file when logging started.
printf OUTPUT
"n%4d-%02d-%02d%02d:%02d:%02dn",$year+1900,$mon+1,$mday,$hour,$min,$sec;
print OUTPUT "$inputn";
}
until $min += 15;