in reply to Re^3: search and replace with a variable
in thread search and replace with a variable
#!/usr/bin/perl use strict; use CGI; use Getopt::Long; use FindBin qw($Bin $Script); my ($BASE,$NAME)=($Bin,$Script) ; my ( $fqdn, $address ); my ( @results, $result, $response ); my $sestimeout = 3600; open(FILE, "<ADDACS.csv") || die "File not found"; my @lines = <FILE>; close(FILE); my $q = CGI->new; my $fqdn = $q->param('fqdn'); chomp $fqdn; my $address = $q->param('address'); chomp $address; my @newlines; foreach(@lines) { $_ =~ s/RECORDNAME/$fqdn1/; $_ =~ s/RECORDIP/$address/; push(@newlines,$_); } open(FILE, ">ADDACS1.csv") || die "File not found"; #print "Content-type: text/plain\n\n"; print FILE @newlines; close(FILE); print "Content-type: text/plain\n\n"; print "$address / $fqdn";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: search and replace with a variable
by davido (Cardinal) on Apr 09, 2014 at 20:36 UTC | |
|
Re^5: search and replace with a variable
by mtmcc (Hermit) on Apr 09, 2014 at 15:58 UTC | |
by tronmason (Initiate) on Apr 09, 2014 at 16:05 UTC |