in reply to Formatting with sprintf

sprintf doesn't apply

#!/usr/bin/perl # http://perlmonks.org/?parent=1147312;node_id=3333 use strict; use warnings; $| = 1; my $card = '1234543267679898'; my $CCformatted = $card =~ s/....\K\B/-/gr; print $CCformatted, "\n";

I had to respond because I love Citabria's.

Replies are listed 'Best First'.
Re^2: Formatting with sprintf
by citabriabob (Novice) on Nov 10, 2015 at 01:00 UTC
    I got a syntax error on the my @CC... line and not smart enough to find where; Would you like a ride in my Citabria?
      What version of perl are you running? \K was introduced to regular expressions in v5.10.0.

      #11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.

      Old perl ?

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

      Most of my PP hours were in Citabria's, but that was 41? years ago :)