in reply to Re^3: Formatting with sprintf
in thread Formatting with sprintf

5.8.8 is waaaaay old.

That's why

my $CCformatted = $card =~ s/....\K\B/-/gr;

doesn't work, the /r came along in 5.14.

my $CCformatted = join '-', $card =~ /..../g;

should still work.

Replies are listed 'Best First'.
Re^5: Formatting with sprintf
by citabriabob (Novice) on Nov 10, 2015 at 19:52 UTC
    $CCformatted = join '-', $cardNum =~ /..../g; still does not work. I have asked host to update Perl to 5.22.0.
      > still does not work

      there must be another bug, I've just tested it with 5.6.2

      lanx$ perl -de0 Loading DB routines from perl5db.pl version 1.07 Editor support available. ... DB<2> $card = join '', 1..9,0..6 DB<3> p $CCformatted = join '-', $card =~ /..../g; 1234-5678-9012-3456 DB<4> p $] 5.006002

      Cheers Rolf
      (addicted to the Perl Programming Language and ☆☆☆☆ :)
      Je suis Charlie!