in reply to Simple formatting question for credit card number
sub format_cc_num { my ($num, $spacer) = @_; $num = reverse $num; $num =~ s/(.{4})/${1}${spacer}/g; return reverse $num; }
------
We are the carpenters and bricklayers of the Information Age.
The idea is a little like C++ templates, except not quite so brain-meltingly complicated. -- TheDamian, Exegesis 6
Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Simple formatting question for credit card number
by Aristotle (Chancellor) on Aug 13, 2003 at 01:04 UTC | |
by dragonchild (Archbishop) on Aug 13, 2003 at 13:00 UTC | |
by Aristotle (Chancellor) on Aug 13, 2003 at 14:28 UTC |