Hi List,

I know the number of files probably doesnt matter, but just in case it does I thought 
I would mention it. What I need to do, is look thru 125 zone files and change the IPs. 
Or to be less specific, I need a Find/Replace script that will run thru a list of 
files whose names are in an array. Here is a snippet of code:

<--snip-->

#!/bin/perl

use strict;

my @files = (
  "zone.file1.com",
  "zone.file2.com",
  "zone.file3.com" )

for ( my $i = 0; $i < scalar @files; $i++ )
{
  open TMPFH, >>$files[$i];      #This is line 123 in the real file
  while ( <TMPFH> ) {
    $_ =~ s/1\.1\.1\.1/5.5.5.5/ ;
    print $_ ;
  }
}

<--snip-->

I dont think I'm writing the substitution line right, but here is the error I'm 
getting:

Use of uninitialized value at zones.1 line 123.
Argument "zone.yourofficeplace.com" isn't numeric in right_shift at zones.1 line 123.

Wouldnt $file[$i] be initialized? I may be wrong about that, but the 'right_shift' 
thing is what I am not sure of. I know I'm close to being right (or at least I think I 
am). Any help is appreciated.

Thanks,

Dave Kettmann
NetLogic

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to