OK, I've been lurking long enough. Got what I think is a very simple
question which may be more of an NT command shell question as it is a Perl
question.

I have a very simple script (below) which reads data from STDIN and converts
the supposed EBCDIC hex data to readable text (yes, I'm a mainframer....).
This works fine when I run it normally from the command line and enter data
from the keyboard. So, if I enter 'c1c2c3c4' when prompted, it will print
out 'ABCD'. Piece o' cake.

Now, I was hoping to pipe data to this script from the output of a previous
command. For example, from NT, you can say:

type testpgm.c | more

....which will pipe the output (STDOUT) from 'type' to the input to 'more'
(STDIN).


OK, so I try the same thing using my script by entering:

type ebcdic.data | hexeb.pl


....and get  "The process tried to write to a nonexistent pipe."   
  

I'm obviously unclear on some concept. Is there a better way to do this?

Thanks,

Murph





use strict;
use Convert::EBCDIC qw(ascii2ebcdic ebcdic2ascii);

my $out;

print "Enter EBCDIC hex string:\n";

while (<>) {
    chomp();
    last if (length() == 0);
    s/\s+//g;
    $out = ebcdic2ascii( pack "H256"  , $_);
    print "$out\n";
}





Dan Murphy                           [EMAIL PROTECTED]   
EMC Corp.                            508-249-3322
Hopkinton, MA  01748

        EMC˛            
where information lives



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to