title: Regex (perl) that will match (globally) one or more spaces occurring other than at the beginning of the line
body: <p>My understanding is that <code>/[^\A] +/mg</code> will match globally one or more spaces occurring other than at the beginning of the string or just after newline.</p>
  
  <p>Apparently, I'm wrong.</p>
  
  <pre><code>#!/usr/bin/env perl
  use strict;
  use warnings;
  
  my $str = "         word1     word2\n     word3     word4     word5\n";
  print "str before = $str\n";
  $str =~ s/[^\A] +/ /mg;
  print "str after  = $str\n";
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>str before =          word1     word2
       word3     word4     word5
  
  str after  =  word word2 word word word5
  </code></pre>
  
  <p>The desired output is:</p>
  
  <pre><code>str before =          word1     word2
       word3     word4     word5
  
  str after  =          word1 word2
       word3 word4 word5
  </code></pre>
  
  <p>So the leading spaces are preserved in number but multiple spaces occurring after the beginning of each line are reduced to a single space.</p>
  
  <p>I'm not finding what I'm looking for in <code>perldoc perlretut</code> nor <code>perldoc perlre</code> (even after searching through all the instances of "[^" with <code>/\[\^</code>). Many thanks, in advance.</p>