in reply to Re^10: Global regex giving up too soon
in thread Global regex giving up too soon

#!/usr/bin/perl use strict; use warnings; my $str = "123456"; $_ = $str; 1 while s/(\d)(\d)(\d)/$3$2/; print "$_\n"; $_ = $str; 1 while s/(\d)(\d)(\d)/$3$2/g; print "$_\n"; __END__ 62 52
Abigail

Replies are listed 'Best First'.
Re^12: Global regex giving up too soon
by Coruscate (Sexton) on Jan 20, 2004 at 13:43 UTC

    Thank you, that knocked it into me. I shall remember the difference.