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

Someone asked about the version: This is perl, v5.8.8 built for x86_64-linux-thread-multi

Replies are listed 'Best First'.
Re^4: Formatting with sprintf
by Anonymous Monk on Nov 10, 2015 at 10:53 UTC

    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.

      $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!