Help for this page

Select Code to Download


  1. or download this
    $string =~ s/^\("(.*)"\)$/$1/;
    
  2. or download this
    # Faster than first.
    $string =~ s/^\("//;
    $string =~ s/"\)$//;
    
  3. or download this
    # Same as previous, less redundant.
    s/^\("//, s/"\)$// for $string;
    
  4. or download this
    # You didn't mention an escape mechanism, so I'm
    # assuming there's no other quotes in the string.
    $string =~ s/"//g;
    
  5. or download this
    # I didn't say it was impossible.
    $string = (split '"', $string)[1];