OT:Perl on Windows

Lennart Sorensen lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org
Fri Mar 11 18:35:57 UTC 2005


On Fri, Mar 11, 2005 at 11:12:34AM -0500, William O'Higgins wrote:
> I am doing some mechanical text processing at work, and it seemed to me
> that I could do it with Perl, but now I'm not so sure.
> 
> Does anyone have any advice for some who wants to write a program like
> this on Windows:
> 
> open an input file
> read file contents into string
> run regex on string
> open an output file
> print string to output file
> 
> On a proper OS it would be easy - there might be permission problems,
> but I could overcome.  The problem right now seems to be that my program
> cannot read the contents of a file, nor can it create an output file.
> Any suggestions?

Install activeperl
Use perl

Now on Linux I would think something like perl -pi -e 's/foo/bar/g' list of filenames
would be easiest, but on windows that may not work the same (since
windows expects programs to expand wildcards rather than the shell).  To
make it easier you could install cygwin and use perl from bash and have
that work.  Of course you could just write the perl code to
opendir/readdir and get each file, process it in a while(<FILEHANDLE>)
loop writing to a new file and it should work pretty easily.

Lennart Sorensen
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list