You also need to make sure that $line is clean of final new lines whitespace, otherwise your regex won't match your line because $line will end in a new line whitespace instead of ';' - see http://perldoc.perl.org/functions/chomp.html. Also you might consider /^;\s*$/ to strip trailing whitespace.
Syntax wise, your regex is fine.
Best, beth
Update:Correction (see jwkrahn and Grandfather below).
In reply to Re: How to match a ;
by ELISHEVA
in thread How to match a ;
by ewhitt
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |