Trim sub with emtpy string display error #376
This commit is contained in:
parent
b9721ef91b
commit
61cdd6c0d0
1 changed files with 1 additions and 0 deletions
|
@ -5059,6 +5059,7 @@ sub mariadb_connect {
|
||||||
# Perl trim function to remove whitespace from the start and end of the string
|
# Perl trim function to remove whitespace from the start and end of the string
|
||||||
sub trim {
|
sub trim {
|
||||||
my $string = shift;
|
my $string = shift;
|
||||||
|
return "" unless defined($string);
|
||||||
$string =~ s/^\s+//;
|
$string =~ s/^\s+//;
|
||||||
$string =~ s/\s+$//;
|
$string =~ s/\s+$//;
|
||||||
return $string;
|
return $string;
|
||||||
|
|
Loading…
Reference in a new issue