Hello and Happy Holidays Perl Monks!
Quick question, I hope, I'm trying to figure out how to keep the Carriage Returns from being added after $one, which is an email address. Here's what I'm working with:
First the data is loaded into a textarea for editing...
open(FILE, "$datadir/$editlist\.txt") || &error_message("Can't find d
+ata file - $datadir/$editlist\.txt.");
@list = <FILE>;
close(FILE);
$numlist = @list;
print "<textarea cols=60 rows=5 name='list'>\n";
$ccc = 0;
for ($a = 0; $a < $numlist; $a ++)
{
($two, $one, $nochop) = split(/,/, $list[$a]);
if ($one =~ /.*\@.*\..*/)
{
print "$two,$one\n";
$ccc++;
}
}
print <<"END";
</textarea><br>
Then the edited code is written to the db:
sub change_list
{
$list = $FORM{'list'};
$editlist = $FORM{'editlist'};
(@splitlist) = split(/\n/, $list);
$numlist = @splitlist;
open(FILE, ">$datadir/$editlist\.txt") || &error_message("Can't find
+data file -$datadir/$editlist\.txt.");
for ($a = 0; $a < $numlist; $a++)
{
($two, $one) = split(/,/, $splitlist[$a]);
$two =~ s/\cM//g;
if ($one =~ /.*\@.*\..*/)
{
print FILE "$two,$one,x\n";
}
}
close(FILE);
Any suggestions to remove the CR's after the value $one?
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.