in reply to Adding formatting to a string
Do you want to insert a hyphen in the middle of the string?
substr($string, (length $string)/2, 0) = '-';
... or insert a hyphen after the fourth character?
substr($string, 4, 0) = '-';
... or insert a hyphen after every fourth character, but not at the end?
$string =~ s/(.{4})(?=.)/$1-/g;
... or something else?
print "Just another Perl ${\(trickster and hacker)},"
The Sidhekin proves Sidhe did it!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Adding formatting to a string
by Anonymous Monk on Jun 16, 2004 at 07:23 UTC |