in reply to Remove Carriage Returns

Any suggestions to remove the CR's after the value $one?
Looks like that's been covered, but I have some other suggestions, if you're open to receiving them.

  1. Use lexical variables.
  2. Stick $! somewhere in your error messages for a failed concat().
  3. Iterate over the data lines using natural Perl idiom, instead of C idiom.
  4. Don't backwhack things that don't need it.
Now, beyond that, it seems to me that you're doing the same operation in more than one place -- namely, filtering and reformatting valid data lines. This makes it a good candidate for a subroutine.

sub valid_lines { map { my( $two, $one ) = split /,/; $one =~ /@.*\./ ? ( "$two,$one" ) : () } @_ } open FILE, "< $datadir/$editlist.txt" or error_message( "Can't read data file $datadir/$editlist.txt - +$!" ); my @lines = valid_lines( <FILE> ); close FILE; $ccc = @lines; local $, = "\n"; print <<EOF; <textarea cols="60" rows="5" name="list"> @lines </textarea><br/> EOF # Then the edited code is written to the db: sub change_list { my $editlist = $FORM{'editlist'}; $FORM{'list'} =~ s/\r//g; # kill useless carriage returns. open FILE, "> $datadir/$editlist.txt" or error_message( "Can't write data file $datadir/$editlist.t +xt - $!" ); for ( valid_lines( split /\n/, $FORM{'list'} ) ) { print FILE "$_,x\n"; } close FILE;
Just an idea.

jdporter
...porque es dificil estar guapo y blanco.