in reply to perl string extract

Anchor your regex eg.
$line=~ s/^ #Anchor at the beginning of the line logfile\s*=\s*([^,]*?) # As before (:?,.*)? # non-capturing optional block beginn +ing with a comma $ # Anchor at end of line /$1/x;

print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."