This works, for example:
#!/usr/bin/perl use warnings; use strict; my $fqdn = 'first'; my $address = 'second'; my @lines = ('RECORDNAME', 'RECORDIP', 'third'); print STDERR "BEFORE: @lines\n"; foreach(@lines) { $_ =~ s/RECORDNAME/$fqdn/; $_ =~ s/RECORDIP/$address/; } print STDERR "AFTER: @lines\n";
In reply to Re: search and replace with a variable
by mtmcc
in thread search and replace with a variable
by tronmason
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |