Hiya. This is what I want to do:
I want to write a Perl script that takes web site alphanumeric submissions. For each alphanumeric submission, I want the script to separate the initial alphanumeric submission into strings that:
-When combined, they equal the initial alphanumeric submission
-Do not exceed 100 characters per string.
For example, consider the following:
$initial = "qwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwerty
+uiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcv
+bnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdf
+ghjklzxcvbnmqwertyuiopasdfghjklzxcvbnm";
$initial has 234 characters. I would like to write a script that chops up $initial into the following:
$chop1 = "qwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwertyui
+opasdfghjklzxcvbnmqwertyuiopasdfghjklzxc"; # (contains first 100 char
+acters)
$chop2 = "vbnmqwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnmqwer
+tyuiopasdfghjklzxcvbnmqwertyuiopasdfghjk"; # (contains second 100 cha
+racters)
$chop3 = "lzxcvbnmqwertyuiopasdfghjklzxcvbnm"; # (contains remaining 3
+4 characters)
such that
$initial = "$chop1$chop2$chop3";
Then, I would like the amount of emails as there are chops. For example, since there were three divisions of $initial, I would want to send each division in a private email (three emails would be total since there are three divisions in existance). I was thinking about doing something that implements foreach. The only problem is that I don't know how to incorporate the divisions into an array.
Help would be VERY much appreciated.
Thanks,
Tony
2002-04-22 Edit by Corion : Added CODE tags.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.