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
In reply to Re: Add space in long string
by toolic
in thread Add space in long string
by lddzjwwy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |