Re: [MacPerl-WebCGI] well split!! (Solved)
[email protected] Wed, 7 Mar 2001 20:13:00 -0500
| Newsgroups | perl.macperl.webcgi |
|---|---|
| Message-ID | <p0501040cb6cc8432d8ae@[64.194.142.225]> |
>I think you may have got it working by fixing the symptom rather than the >problem. > >It seems that your while(<DATA>) part is still reading the whole file in in >one go... this is most likely because you have the wrong line endings on the >file for that OS. you are then "fixing" this by using the split(/\r/) part >which splits the whole file content into lines at \r (this is what you >wanted the while(<DATA>) to do in the first place). I'm not doubting you, but doesn't the first condition "\r" read the data file and dump the first segment (i.e., start-of-first-record to first-return) into the $_. After that, the "\t" further evaluates the $_ with respect to tabs? If it doesn't and loads the entire data file in at one time, as you suggest, then how can I continue to dissect the $_ by using "\t" and get the right answers? > >From "MacPerl Power and Ease": > >On Unix systems, the line-ending separator (record separator) is the line >feed (ASCII \012). On MacOS, it's the carriage return (\015). On MS-DOS and >Windows systems, its the sequence "carriage return/line feed" (\012\015)." > >and.... > >"...\r (which produces a return without a newline under Unix Perl), produces >a line feed under MacPerl." > >What platforms are you running this on? > >adam > adam: I don't run the code I referenced on my Mac. In fact, I seldom run any perl code on my Mac. It's too much of a hassle to change from one environment to another -- even with Quid Pro Quo. If I want to write code for my Mac, I use a different language. So, I use my DSL to upload my perl code to my server and run it there via Netscape. After all, that's where I want it to run anyway. I don't care if it runs, or not, on my Mac -- it's cgi. So, to answer your question, I my code runs on: Apache/1.3.3 Cobalt (Unix) (Red Hat/Linux) PHP/3.0.7 Now, my data file is configured to have a <ret> at the end of each record. I realize that a <ret> means different things to different environments. All I know is that if I look at the ASCII values of the data text file with a HEX editor, each record ends with 013 (DEC) (00D (HEX)) (015 (OCT) which is a CR on the Mac. With that said, should I be using a different EOR delimiter? After all, I can make it anything I want. Thanks for your perspective. tedd -- http://sperling.com/