punkwalrus (punkwalrus) wrote,
punkwalrus
punkwalrus

  • Mood:
  • Music:

Perl - The Case of the No-break Space

I finally finished a Perl project that I have been working on almost nonstop for days. One of the major stumbling blocks was I had to take this so-called "text output," parse it, and extract the right data from it. The biggest stumbling block is that it's on the ancient piece of hardware called an HP3000, and what it considers "text output" isn't always the vanilla ASCII you want it to be.

For instance, I did $record =~ s/\s+/,/g; to search and replace all spaces with commas so I could parse the data out. But some fields were not separated by spaces, no! It finally took me doing a character-by-character comparison to find out that not all the spaces were chr(32), like the normal world, but some were chr(160). One sixty? WTF? (In fact, I called the variable $wtf) Who uses chr(160) as an "alternate space?" Jesus. So I had to parse down all the spaces, then tabs, THEN chr(160), which I learned was called a "no-break space" way back when. Of course.

This HP3000 is only one step better than terminal line printers and punch cards.

Anyway, that was the breakthrough that I needed. A majority of my work for this group is to take stuff they have been doing by hand for the last half a dozen years and automate it. Every day, I find out some new thing they have been doing by hand.

Perl has been a godsend with parsing data.
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments