title: perl how to remove last '_'?
body: <p>In perl, how to write this regex ? </p>
  
  <pre><code>my $line = "job_name_1_" ; #end with '_'
  
  $pattern = "_$"; # tried "\_$", still doesn't work
  
  if($line =~ m/$pattern/){
      # remove last "_" ?
  }
  
  -#output should be "job_name"
  </code></pre>
  
  <p>how to do this ?</p>