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.
Just an idea.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;
jdporter
...porque es dificil estar guapo y blanco.
|
|---|