Limbic~Region has asked for the wisdom of the Perl Monks concerning the following question:
I briefly discussed this in the CB before deciding to post it here as there was no obvious concensus reached. Keep in mind there will be an unknown number of newlines but the string itself will be no larger than 200K.
sub build_str { my ($str, $max) = ('', 200 * 1024); while ( length($str) < $max ) { # Assume lines are between 60-79 characters long $str .= ('#' x ((rand 20) + 60)) . "\n"; } return $str; }
Cheers - L~R
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Finding the positions of a character in a string
by demerphq (Chancellor) on Nov 28, 2005 at 15:30 UTC | |
by sauoq (Abbot) on Nov 28, 2005 at 16:17 UTC | |
by demerphq (Chancellor) on Nov 28, 2005 at 16:22 UTC | |
|
Re: Finding the positions of a character in a string
by Limbic~Region (Chancellor) on Nov 28, 2005 at 17:35 UTC | |
by Roy Johnson (Monsignor) on Nov 29, 2005 at 19:40 UTC |