in reply to Add space in long string

http://perldoc.perl.org/perlfaq5.html#How-can-I-output-my-numbers-with-commas-added?
use warnings; use strict; my $bin = '1001100010100001'; print add_space($bin), "\n"; sub add_space { # Add space separator # Code adapted from perlfaq5: How can I output my numbers with com +mas added? local $_ = shift; 1 while s/^([01]+)([01]{4})/$1 $2/; return $_; } __END__ 1001 1000 1010 0001

Replies are listed 'Best First'.
Re^2: Add space in long string
by lddzjwwy (Novice) on May 28, 2013 at 12:26 UTC
    Thank you so much toolic!