if($line =~ m/API#[^#]/) { ...
The negative character class makes the regex reject the doubled-#, as per OP's question.
Update: Better answer below at Re^3: String Match. ++ happy.barney!
In reply to Re^2: String Match
by ww
in thread String Match
by zeni
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |