Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^2: odd behavior with DATA section

by Nkuvu (Priest)
on Jul 23, 2005 at 03:36 UTC ( [id://477414]=note: print w/replies, xml ) Need Help??


in reply to Re: odd behavior with DATA section
in thread odd behavior with DATA section

After first running into the issue, I double checked line endings and tab characters in UltraEdit, using the view invisible characters bit. I should clarify, this is not Cygwin Perl, it's ActiveState Perl. I have Cygwin installed, but this is called from a Windows command prompt, not a Cygwin shell (and actually Cygwin Perl isn't even installed). The only reason I was using the Cygwin mkdir is so I didn't have to parse out the path and do repeated mkdir calls (the -p switch, if you're not familiar, creates all intermediate directories as necessary).

The original list of files and directory structures (with the not-so-innocent names) was created by someone else in Excel. I copied the data to emacs where I created the script. For the innocently named script I copied the source code, then typed the DATA lines by hand, still in emacs. So no possiblities of pasting odd characters in there. For the OS X test I copied the source code and DATA from Perlmonks into emacs.

So the short story is that I'm fairly sure that the line endings are correct for the operating system under test.

But all that being said, I would not be too surprised to learn that your suspicions are accurate. I just double checked the output of the script, and noticed that the DATA line errors occur on lines 2, 4, 6, et cetera. Yet what I would expect to be line 2 in the DATA section worked fine.

Of course now that I'm home I don't have the original script files, so I'll have to triple check line endings when I go back to work on Monday. Thanks for the input.

Replies are listed 'Best First'.
Re^3: odd behavior with DATA section
by TilRMan (Friar) on Jul 23, 2005 at 06:52 UTC

    Gather more data about what perl is doing. Print out the value of $line, paying close attention to the line ending. Save the return value of chomp $line, print it, and see if it is what you expect.

      Printed out the value of $line before and after chomp-ing, and it looked just like I expected. With a single newline before, and no newline after. The return value of chomp is the number of things chomped, so I expected a 1. I got a 1. No surprises there.
Re^3: odd behavior with DATA section
by digiryde (Pilgrim) on Jul 24, 2005 at 03:16 UTC
    I have run into issues like that on UltraEdit in the past where characters did not show up in the edit screen that were there in the file. I still use UltraEdit, but I am a little more wary of things like that now.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://477414]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2024-04-19 23:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found