Perl Shell - A Solution


This expression tries to match $_ against this pattern: the beginning of the string (^) followed by zero or more whitespace characters (\s*), then a semicolon (;), then possibly some more whitespace (\s*). If it matches, the matching part of the string is stripped out (ie, substituted with nothing) and the whole expression has a true value. If not, it just has a false value.