Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stopping Enter from Inserting Lines in Log

Status
Not open for further replies.

tbad1986

Technical User
Apr 1, 2002
24
0
0
US
Right now I have my perl script to read the log file and then on each line print it out accordingly.

Well, when someone enters news (it is a text box, so it's more than one line in height) they tend to press enter for a new paragraph/etc. When they do this, it will move the log file down, so it will look like this:
Name/News
/Date
Instead of
Name/News/Date

This really screws up the tables and I have to go back and edit it all out. Is there any way to fix it so that when someone presses enter it won't move it down in a log and instead make it a <br> so it won't effect the perl?

These are the parts of the Perl I think you might need:

print OUTF join($SEPARATOR, $handle, $email, $news, $today), &quot;\n&quot;;
close (OUTF);

Then:

open(INF, $newsfile)
or errors(&quot;Sorry, but their was an error. Please contact the website admin!&quot;);
my @news = reverse( <INF> );
close INF;

print <<End;
<link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot; <title>news</title>
End

foreach $line (@news) {

($handle,$email,$news,$today) = split(m/$SEPARATOR/, $line);
 
geez guy u r complicating your life alot for nothing
enhance your split/splice functions....
 
I don't really know how. I'm new to Perl and have to rely on others to teach me to learn it since I can't find any good guides/books locally or on the internet.
 
remove '\t' and '\n'
$textarea_value =~ s/[\t\n]+/ /gimos;[/red]
was that is that u needed ?
wink
 
maybe this is what you want ->

open(INF, &quot;./foo.txt&quot;) or die &quot;file i/o err: $!\n&quot;;
my @news = ();
chomp(@news = (<INF>));
close INF;

my $i = join('', @news);

just a note: I really like the o'reilly perl books. or,
if you are in a shell you could try 'perldoc -f join, for use on perldoc try 'perldoc --help'. anyway, hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top