in reply to Re3: Simple formatting question for credit card number
in thread Simple formatting question for credit card number

Oops. I was going to use unpack at first and didn't think about that when going for the pattern instead. The fix is obvious, though.
sub format_cc { my ($n, $s) = @_; scalar reverse join $s, (reverse $n) =~ /(.{1,4})/g; }

Makeshifts last the longest.