title: To remove the newline character of a variable in perl
body: <p>I have my perl code like this</p>
  
  <pre><code>my $test = "gsfdsd gsfgsfg sfghsdg 
  Starting 
  gahgahd vvsfdh";
  
  $test=~ m/(.*)Starting(.*)/;
  print"test value = $1 \n";
  </code></pre>
  
  <p>when I execute this code, I get nothing i.e., </p>
  
  <pre><code>test value =  
  </code></pre>
  
  <p>But when the <code>$test</code> strings are in the same line i.e.,</p>
  
  <pre><code>my $test ="gsfdsd gsfgsfg sfghsdg Starting gahgahd vvsfdh"; 
  </code></pre>
  
  <p>I get the result for the print statement to be </p>
  
  <pre><code>test value = gsfdsd gsfgsfg sfghsdg.
  </code></pre>
  
  <p>What's the problem with the first case. The only difference is the inclusion of newline space. How to make the first code get executed.</p>