|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Basic Perl Question
I'm making a perl message board, with a list file for the order of the topics. For some reason it adds a space on the end of each line of the list.cgi. How would I remove it?
Teckwiz |
|
#2
|
|||
|
|||
|
|
|
#3
|
|||||
|
|||||
|
still no.... let me give you some of the source code...
post.cgi Quote:
forums.cgi - part A[/b] Quote:
[U]forums.cgi - part B Quote:
|
|
#4
|
||||
|
||||
|
In post.cgi, just have this:
Code:
print FILE "$nextid\n"; instead of this: Code:
print FILE "$nextid\r\n"; The \r is not needed and is probably causing the extra space... |
|
#5
|
|||
|
|||
|
even when i didnt have that... it had it...
i even manually edit the file and still... i dunno |
|
#6
|
|||
|
|||
|
nevermind
|
|
#7
|
||||
|
||||
|
I think the following line may be a mistake:
Code:
$filetoopen = "$boardpath" . "forum$forum/@topics/1.thd"; Is it supposed to read: Code:
$filetoopen = "$boardpath" . "forum$forum/$topic/1.thd"; ?? That may be also why you're getting the extra spaces. |
|
#8
|
|||
|
|||
|
I'll try that
|
|
#9
|
|||
|
|||
|
>> even when i didnt have that... it had it
If it's ^M, then that's \r\n. Note, ^M is not visible from cat list.cgi, use vi list.cgi instead. If you have ^M, that was because you uploaded your scripts to your server via Windows in binary mode. To trim all that, just follow the link I posted earlier and do something like this: perl -i -pne 's/\r\n/\n/g' *.pl or perl -i -pne 's/\r\n/\n/g' *.cgi Yes, it takes wildcard so you don't have to do it one by one. |
|
#10
|
|||
|
|||
|
i switched around the way i handle files so i dont need this anymore, thanks
![]() |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > Basic Perl Question |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|