Question : perl, strip spaces and  double quote character at beginning and at the end of a string

How do I strip spaces and double quote character at beginning and at the end of a string, if the double quote exist?

$string1 = "\"my string1\"";  # => to "my string1"
$string2 = "  \" my string2 \"  "; #=> to " mystring2 "

Answer : perl, strip spaces and  double quote character at beginning and at the end of a string

Please try this:
   s/(^\s*")|("\s*$)//g;
Random Solutions  
 
programming4us programming4us