How do I run a perl script?

I’ve been looking all over for a simple plugin for Word that tabulates each word and the # of times it occurs in the Word Document. I could have sworn I’d used something like that in college, but I can’t find one now.

In light of this, the closest I’ve found is this guys Perl Script: http://merenbach.com/software/scripts/wurdz/

But I can’t figure out how to make it scan a file. I’ve installed Activeperl so Perl is on my computer… and I even installed a trial editor called DzSoft Perl Editor (sucks cause if I had to, could only edit first 120 lines of code).

Thanks to anyone that can help.

Hmmm.

Assuming that ActivePerl’s bin directory is added to your PATH, just navigate to a directory that contains both the Perl script and the text document (that Perl script is plain text only) and type:

perl wurdz.pl <yourdoc.txt>

That should do it. If you want a decent editor, try googling for Notepad++ - it’s free and it does code highlighting and so on which should make reading the Perl script easier to do.

I’m getting a permission denied. If I change it from just wurdz to wurdz.pl I get a file or directory does not exist.

I feel like such a total newb.

Ok, you definitely need to specify it as wurds.pl

Secondly, the “file or directory does not exist” error seems like it’s because perl cannot find the file wurds.pl.

The biggest issues with stuff like this is file paths - make sure your PATH variable has the ActivePerl directory in it (go to My Computer from the Start button, then select “View System Information” from the left side of the window. Click the “Advanced” tab, then the “Environment Variables” button near the bottom of the window. Look for PATH in either the top or bottom list there. Wherever you find PATH, select it, then click Edit to bring up an edit dialog. Carefully scroll around there to see if the ActivePerl directory is in that list - it should have a semicolon in front and behind it).

Once you’re sure your PATH is right, put the wurds.pl in the same directory as your word processing document. Then open a cmd window or use whatever ActivePerl gives you and navigate to that directory. Then when you try to run that script it will work.

Easiest way to do this would be to copy the word processing doc and the words.pl into the toplevel of your C: drive. Then you can just type:

perl C:\wurds.pl C:\document.doc

and it will (probably) work.

Ahem.

=head1 NAME

Wurdz - a simple statistical-analysis program for text files
	
=head1 SYNOPSIS

wurdz [-f filename]

=head1 OPTIONS

-f <filename>	the file to process

You’re not forgetting the “-f”, are you?

Nope, didn’t forget that.

Charlatan., that worked. Thanks so much!

Hey! I told you more or less the same thing!