This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
On Mon, 20 Jul 1998 address@hidden wrote: > robb, > > this is really more of a perl question than a general decoder question. > i currently have a couple of decoders working here on my machine that > i think were written by you. your name appears in some of the commented > out directory names. anyway, i needed to write a decoder of my own to > handle some local data and i adopted a little of your perl knowledge > into my program. i am a perl novice by the way, but making progress. > > my problem is that my data used to be in seperate files > so it was no problem reading in the whole file as 1 string. now, my > format has changed and the data is in one file. i know how to > extract the substrings etc, but what i can't figure out is how to > 'not' read the whole file as one string. i only need two or three > lines at a time as a string. each station is seperated by a blank line. > > since i have corresponded with you via e-mail some time ago about these > decoders, i was wondering if you could shed some light on how to maybe > accomplish this. i can use "1998" as the beginning of line anchor and > a blank line (the length of which is 2) as the end of line anchor. i just > cant figure out the syntax of this operation. if you are too busy > i totally understand. thanks... > > dave bennett > Dave, This line says it all: # Now begin parsing file and decoding observations breaking on cntrl C $/ = "\cC" ; This says to reads input until a control C is encountered, the default is to read individual lines. ie "\n" . One can set it any control character, I never tried any other type of chars. Robb... =============================================================================== Robb Kambic Unidata Program Center Software Engineer III Univ. Corp for Atmospheric Research address@hidden WWW: http://www.unidata.ucar.edu/ ===============================================================================