J
julia
I have a input file and want to create an output file that contains
the converted digit we find in inputfile. Can you help me fix the
script ?
Inputfile
23456
3216,98
3452
40
4
outputfile
*****
****,**
****
**
*
sub doReplace
{
my @outLines; #Data we are going to output
my $line; #Data we are reading line by line
open (FILE, $in ) or
die "Cannot open file: $!";
while ( $line = <FILE> )
{
$line =~ s/\d{4}/****/;
$line =~ s/\d{5}/*****/;
$line =~ s/\d{8}/*********/;
push(@outLines, $line);
}
close FILE;
open ( OUTFILE, ">$out" ) or
die "Cannot open file: $!";
print ( OUTFILE @outLines );
close ( OUTFILE );
undef( @outLines );
}
the converted digit we find in inputfile. Can you help me fix the
script ?
Inputfile
23456
3216,98
3452
40
4
outputfile
*****
****,**
****
**
*
sub doReplace
{
my @outLines; #Data we are going to output
my $line; #Data we are reading line by line
open (FILE, $in ) or
die "Cannot open file: $!";
while ( $line = <FILE> )
{
$line =~ s/\d{4}/****/;
$line =~ s/\d{5}/*****/;
$line =~ s/\d{8}/*********/;
push(@outLines, $line);
}
close FILE;
open ( OUTFILE, ">$out" ) or
die "Cannot open file: $!";
print ( OUTFILE @outLines );
close ( OUTFILE );
undef( @outLines );
}