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:
File parsing problem, Use of uninitialised value error.

 

First page Previous page 1 2 Next page Last page  View All


BillKSmith
Veteran

Nov 14, 2012, 8:13 AM

Post #26 of 31 (3060 views)
Re: [FishMonger] File parsing problem, Use of uninitialised value error. [In reply to] Can't Post

FishMonger,

Your solution appears to be about the same as mine but with all the error detection and recovery that Laurent specified. Good job.

It appears that the discrepancy in the quoting has been the underlying problem. I hope so!
Good Luck,
Bill


MB123
Novice

Nov 14, 2012, 8:39 AM

Post #27 of 31 (3056 views)
Re: [FishMonger] File parsing problem, Use of uninitialised value error. [In reply to] Can't Post

When I open the file in Excel I don't see the extra quotation marks, but they appear when I open it in Notepad. So is it most likely that perl is viewing it with extra quotation marks?


FishMonger
Veteran / Moderator

Nov 14, 2012, 8:56 AM

Post #28 of 31 (3051 views)
Re: [MB123] File parsing problem, Use of uninitialised value error. [In reply to] Can't Post

Since this is a plain text file, why are you opening it with Excel instead of a text editor? That doesn't make any sense.

If the quotes aren't showing up in Excel, then you used the wrong import settings.

Perl is reading the file correctly, but Excel isn't because you used the wrong import settings.


MB123
Novice

Nov 14, 2012, 9:07 AM

Post #29 of 31 (3049 views)
Re: [FishMonger] File parsing problem, Use of uninitialised value error. [In reply to] Can't Post

The file initially came to me in .tab format, and excel was the default program for opening it. I then saved it in a .txt format.


MB123
Novice

Nov 14, 2012, 9:12 AM

Post #30 of 31 (3048 views)
Re: [MB123] File parsing problem, Use of uninitialised value error. [In reply to] Can't Post

Gahhh....

I just downloaded Notepad++ and used that... script worked perfectly.

I'd like to thank you all for your help, and I'd like to apologise for the trivial nature of the problem!

Many thanks.


Laurent_R
Enthusiast / Moderator

Nov 14, 2012, 3:10 PM

Post #31 of 31 (3035 views)
Re: [MB123] File parsing problem, Use of uninitialised value error. [In reply to] Can't Post

Good to see that you are finally where you wanted to be.

One lesson to be drawn: don't open a text file with Excel (or Word or other word processors, for that matter) if you are planning to save it and hope to process it afterwards. MS Office applications are likely to add all kinds of characters (sometimes invisible) or also remove some others which will often ruin subsequent processing, be it in Perl or with any other language.

Text editors (as opposed to word processors) such Notepad++ are good at that because they preserve the text. Uner Windows, you could also use the Crimson Editor, Ultra Edit (shareware), jEdit, etc.

First page Previous page 1 2 Next page Last page  View All
 
 


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

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