use Data::Dumper; use 5.01800; use warnings; my @cell_names; open INPUT_FILE,"<",my $ip_file="11116963.txt" or die "\n!!!ERROR OPENING INPUT FILE. EXITING SCRIPT!!!\n"; while () { #warn Data::Dumper->Dump([\$_],[qw(*_)]),' '; if ($_ =~ /(.*) =\n/) { print "\nFormat not correct on line $. of input file. Exiting script\n"; exit; } elsif ($_ =~ /(.*) =\s+\n/) { print "\nFormat not correct on line $. of input file. Exiting script\n"; exit; } elsif ($_ =~ /(.*) = \s+(.*)/) { print "\nFormat not correct on line $. of input file. Exiting script\n"; exit; } elsif ($_ =~ /^TASK_CELL_NAME\|VALUE = (.*)/) { my $cell_name=$1; unless (grep(/^$cell_name $/,@cell_names)) { push @cell_names,"$cell_name "; #$count++; print "\nCELL NAME: $cell_name\n"; replace($cell_name); } } # elsif ($_ =~ /^TASK_CELL_NAME\|VALUE = (.*)/) } # while () close INPUT_FILE; exit; sub replace { our $rpl; while () { chomp; #warn Data::Dumper->Dump([\$_],[qw($_)]),' '; my $cell=$_[0]; if ($_ =~ /^TASK\|VALUE = (.*)/) { #warn Data::Dumper->Dump([\$_],[qw(*_)]),' '; my $task=$1; #chomp $task; $rpl=$cell.'_'.$task.'_bunch_rpl'; print "000: $rpl\n"; } # if ($_ =~ /^TASK\|VALUE = (.*)/) elsif ($_ =~ /^(.*)\|VALUE = (.*)/) { #warn Data::Dumper->Dump([\$_],[qw(*_)]),' '; my $line=$_; #chomp $line; my $ip_var=$1; my $ip_val=$2; #chomp $ip_var; #chomp $ip_val; my $look=$ip_var."|VALUE"; open(REPLAY_FILE,"<",$rpl) || die "\ncannot open $rpl\n"; while (my $rpl_sub=) { if ($rpl_sub =~ /^$line/) { print "\n 111: $ip_val"; } } close REPLAY_FILE; } # elsif ($_ =~ /^(.*)\|VALUE = (.*)/) elsif ($_ =~ /^\s*$/) { #warn Data::Dumper->Dump([\$_],[qw(*_)]),' '; print "\n"; return; } } # while () } # sub replace