mhearse has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use strict; my $var = 'x' x 10000; my $var_length = length $var; my $max_length = 100; my $last_length = 0; while ($var_length > 100) { $last_length+=$max_length; $var_length-=$max_length; $var =~ s/\S{$last_length}/$&\n/sg; } print $var, "\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Breaking up a really long string
by FunkyMonk (Bishop) on Jun 23, 2008 at 21:11 UTC | |
|
Re: Breaking up a really long string
by johngg (Canon) on Jun 23, 2008 at 21:56 UTC | |
|
Re: Breaking up a really long string
by ikegami (Patriarch) on Jun 23, 2008 at 23:22 UTC | |
|
Re: Breaking up a really long string
by moritz (Cardinal) on Jun 23, 2008 at 21:26 UTC | |
by almut (Canon) on Jun 23, 2008 at 21:57 UTC | |
by mhearse (Chaplain) on Jun 23, 2008 at 21:52 UTC | |
|
Re: Breaking up a really long string
by caelifer (Scribe) on Jun 23, 2008 at 22:02 UTC | |
|
Re: Breaking up a really long string
by almut (Canon) on Jun 23, 2008 at 22:12 UTC | |
|
Re: Breaking up a really long string
by ikegami (Patriarch) on Jun 23, 2008 at 23:17 UTC | |
|
Re: Breaking up a really long string
by jwkrahn (Abbot) on Jun 24, 2008 at 01:51 UTC | |
|
Re: Breaking up a really long string
by ysth (Canon) on Jun 24, 2008 at 15:47 UTC |