I know that the following three lines of codes aim to extract the string into $value and store it in $header. But I do not know what are the differences between $value =~ s/^\s+//; and $value =~ s/\s+$//;.
$value =~ s/^\s+//;
$value =~ s/\s+$//;
$header[$i]= $value;
From
perldoc perlfaq4:And from
perldoc perlrequick: