Thank you
thanos1983 for your help.
The above mentioned code will be working if we remove the "HARD CODED" "default_operating_conditions : "AB0.5v45c" ;". If you look at my code, I am doing some operations for getting "AB0.5v45c" from " operating_conditions ("AB0.5v45c") { " .
Can you please review the code
#!/usr/bin/perl
use strict;
use warnings;
use IO::All;
use Data::Dumper;
use feature 'say';
my @operating_cond;
my @lines = io('file.txt')->chomp->slurp;
#print Dumper \@lines;
for my $i (0 .. $#lines) {
if ($lines[$i] =~ /operating_conditions/) {
#print "$lines[$i]\n";
@operating_cond=split (operating_conditions,$lines[$i]);
@operating_cond=split ("{",$operating_cond[1]);
@operating_cond=split (/\(/,$operating_cond[0]);
@operating_cond=split (/\)/,$operating_cond[1]);
# Insert at position 12, replace 0 elements.
splice @lines, $i + 5, 0, 'default_operating_conditions : "@operat
+ing_cond" ;';
last; # break loop
}
next;
}
print Dumper \@lines;
Thank you for your help :)