CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
"?" added at the end of dir on Linux Server

 



sumit2606
New User

Mar 2, 2015, 6:43 AM

Post #1 of 2 (2684 views)
"?" added at the end of dir on Linux Server Can't Post

Hi all,

When I tried to run the attached script on Linux server "?" mark is added at the end of dir.

But If I run the same script on the Windows it works fine.

Can any one help what should be the issue?

Thnx

Sumit
Attachments: Filter.txt (30 B)
  test_sumit.pl (2.67 KB)


Laurent_R
Veteran / Moderator

Mar 2, 2015, 10:02 AM

Post #2 of 2 (2681 views)
Re: [sumit2606] "?" added at the end of dir on Linux Server [In reply to] Can't Post

I strongly suspect that your input file has been prepared under Windows ans is used under Linux.

Windows lines end with "\r\n" and Unix lines end with "\n" only.

If your was prepared under Windows and is processed in Perl under Unix, the chomp function will only remove "\n", thus leaving the "\r".

Try to replace the chomp with a regular expression such as:


Code
s/[\r\n]//g;


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives