From: papapep <[EMAIL PROTECTED]>
> How should I do to split a long string that the only thing I know is
> that is a multiple of a previous defined number (for example 26).
>
> A graphic example:
>
> abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqr
> stuvwxyzabcdefghijklmnopqrstuvwxyz
>
> That's four times 26 (104) but I don't (I can't) count every string
> because they are really long (They can be of thousands of
> charachters).
>
> So what I should do, I think, is a loop that get the first 26
> charachters and print them in a new file, after that evaluates if
> there is more string to get, and so on, but I am not able to see how
> it works... :-/
while ($long_string ne '') {
my $chunk = substr( $long_string, 0, 26);
substr( $long_string, 0, 26) = '';
# yes I know this looks strange. Forget Computer Science, it does
# what it looks like doing.
...
}
Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]