Hello hemantjsr,
Like Laurent_R, I don’t understand what you are trying to do. However, in the code posted I do notice a major problem in the use of variables. First, in the lines:
foreach my $line (@lines) { $line = $_;
$_ is undefined, so you are immediately deleting the contents of $line and replacing them with undef. (And the line would accomplish nothing, anyway, even if $_ did contain the next element of @lines, as that element has already been stored in $line via the foreach statement.)
Second, in the lines:
$line[0] =~ s~/4947000219/\K(4947000210+)~$1+$n~e; $line[1] =~ s{:20140924105028\K(\d+)}{
you are accessing the first and second elements of the array @line. But as this array has never been declared, the substitutions have nothing to work on. Please note that the array @line is an entirely different variable from the scalar $line. (I notice that you do declare a variable my $lines, but that variable is never used.) If you begin your script with:
use strict;
this will provide some (but not all) of the help you need to identify errors of this kind. See also Perl variable types and perldata.
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
In reply to Re: Dear Monks, Have created multiple files from one file ...
by Athanasius
in thread Dera Monks, Have create multiple file from one file now I want to match a pattern in each file at the same time do the replacement with adding one to the match pattern.
by hemantjsr
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |