On 3/3/2011 4:07 PM, Greg Aiken wrote:

im wanting to write a simple perl 'filter' program in windows.

I basically took the base code found here...

http://www.techrepublic.com/blog/programming-and-development/simple-filters-in-perl-ruby-and-bourne-shell/3481

the sample here is simple, convert upper case single byte ascii chars to lower case.

#assume youve got a text file, 'test.txt' = 'THIS is a test file'

#this works on windows:

#  filter.pl test.txt

#this doesnt seem to work on windows (should it?):

#  type file.txt | filter.pl

while (<>) {            #read input from std in

        print lc($_);   #print to std out the lowercase string

}

C:\perlsrc\getc>filter.pl test.txt

this is a test file

C:\perlsrc\getc>type test.txt

THIS is a test file

C:\perlsrc\getc>type test.txt | filter.pl

The process tried to write to a nonexistent pipe.

when invoked as filter.pl test.txt -- it works fine. but in this case nothing is technically being 'piped' into filter.pl. instead I am giving it the name of a file as an ARGV.

when invoked as a true filter, type test.txt | filter.pl, it croaks with 'the process tried to write to a nonexistent pipe'.

I am not sure if what I am trying to do can be achieved with such simple code on windows.


Bug in your version of Windows. Workaround: type test.txt | perl filter.pl
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to