Hi, If you are using Unix, for a one off operation you should be using the sed program... like this:
sed s/pattern/replacement/g It takes standard in, and puts its output on standard out. I normally use it like: cat FILE | sed s/pattern/replacement/g > OUTPUT However, the perl solution is fairly simple and of course can be expanded easily. Here is how I would do it: --- SCRIPT --- #!/usr/bin/perl -w use strict; my $filename = shift; open (FILE, $filename) or die "Canīt open file: $!"; while ( <FILE> ) { s/$pattern/$replacement/; print; } close FILE or die "Can't close file: $!"; --- END SCRIPT --- I haven't tested it, but it *should* do what you want. In your script you should use =~. This is a single operator, whilst = ~ is two operators... doing something completely different. Also, where does the loop take the input, and assign it to the variable you do that pattern match on? Take care, Jonathan Paton __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]