The ; is used as a statement delimiter, so placing multiple ; at the end of a statement is fine as it just adds empty statements.
I came across this code which has multiple ; at the end but deleting them causing errors:
$line =~s;[.,]$;;;
should be same as
$line =~s;[.,;]$;
but it is not. What’s going on?
In your code only the last
;is the statement delimiter. The others are regex delimiters which the substitution operator takes. A better way to write this is:Since you must have the statement delimiter and regex delimiters in your statement, you can’t drop any of the trailing
;