Gossamer Forum
Home : General : Perl Programming :

Simple Replacement Using Variables

Quote Reply
Simple Replacement Using Variables
I want to build upon the script below to find the "$inside" scalar found in "ip.list" and search and replace $inside with $global found in another file, (let's call it pix.acl). I know I have done this before but I can't remember how I did it. Any Help would be great.

#!/usr/bin/perl -w

@IP=`cat ip.list` ;

$filename = "nat.102";
foreach $item(@IP)
($global, $inside) = split(/ /, $item);

print "$global\n";

"ip.list" just has two columns in it. If I were to run this I would just get the output of the "$global" scalare. This works.