adamsj has asked for the wisdom of the Perl Monks concerning the following question:

So I've got this SAR output from a mainframe that I've ftp'd to my PC so I can parse it. But I can't parse it--in fact, I can't read more than the first few lines of it before the program terminates.

After trying lots of stuff, I pared it down to a minimum:

use strict; my $i; open(DC08, '<c:\temp\dc08dl03a.txt'); open(DCOU, '>c:\temp\dc08dl03.txt'); DC: while (<DC08>) { print DCOU "$_\n"; } close(DC08); close(DCOU);
Over 3000 lines in that file, but only the first 57 copy. When I yank the offending line, another few copy, then it stops again. I could iterate out the offending lines, but hey! That's harder than doing the whole thing by hand!

So--I ftp'd the data and the script over to a UNIX node, and there, everything is copacetic.

Clearly, there's something in the input breaking Perl. Is it a bug in Build 628? Or is it a bug in 5.6.1? The UNIX server is running the venerable 5.003 (and will for some time, I'm sure.)

adamsj

These are my principles. If you don't like them, I have others. --Groucho Marx

Replies are listed 'Best First'.
Re: A bug in ActiveState Build 628? Or is it just Perl 5.6.1?
by Zaxo (Archbishop) on Jul 11, 2001 at 00:24 UTC

    That it works after ftp suggests that the character encoding differs (EBCDIC?) and that an ascii-mode transfer got it translated for you. An appropriate tr/// step with binmode and $/=''; may be all you need to do.

    After Compline,
    Zaxo

      Thanks! Albannach sent me a similar suggestion in /msg and it worked great. The moral of the story is, either don't use Win2K when UNIX is available, learn to use Win2K properly, or pay attention when you're ftping.

      adamsj

      They laughed at Joan of Arc, but she went right ahead and built it. --Gracie Allen