"John Bokma" <> wrote in message
news:...
> Troll wrote:
>
> > Hi,
> >
> > This is what I have:
> >
> > #!/usr/bin/perl -w
> > use strict;
> >
> > sub replace {
> > s/one/two/;
> > }
> >
> > open (INFILE, "ARGV[1]") || etc...
> ^^^^ that's not perl
>
> > while (<INFILE>) {
> > replace ();
> > print $_;
> > }
> >
> > but the file contents do not get replaced from one to two. Any hints?
>
> I guess that there is no file ARGV[1]?
>
> --
> Kind regards, virtual home: http://johnbokma.com/ ICQ: 218175426
> web site hints: http://johnbokma.com/websitedesign/
> John I count my toes ~ one to ten ~ I meditate ~ and feel the Zen
>
Sorry John. I could have included more info. The script is run like
$ replace.pl DIR file.txt <<< where DIR is the directory location of the
file and file.txt is the file itself. Both exist.
What I'm trying to do is pass the directory name and the filename as command
line parameters. This file then gets modified ie. one is replaced with two.
Is this clearer?
Sorry there was a typo here. Doesn't this open the file.txt passed thru the
command line?
open (INFILE, "$ARGV[1]") || etc...