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, |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Dear Monks, Have created multiple files from one file ...
by hemantjsr (Initiate) on Jan 01, 2015 at 18:06 UTC | |
by Corion (Patriarch) on Jan 01, 2015 at 18:09 UTC |