The code I have is
open(IN, "$vPath3$vName5") or die 'Could not open file for reading';
open(OUT, ">$vPath3$vName6") or die 'Could not open file for writing';
foreach $line (<IN>)
{
@field = split(/\,/, $line);
$numb = substr($field[10],0,1); # first digit of number
$find = $field[1];
$fond = $field[19];
chomp($date = 'date "+%y%m%d"');
$line =~ s/^$fond/$date/;
if ($numb == 1) # PO number starts with a 1
{
$line =~ s/$find/0120/;
print OUT $line;
}
This is working to find the first digit of the PO number and insert the company number into field 1.
Field 19 is blank and I am trying into insert today's date in the YYYYMMDD format.
The result is
date "+%y%m%d"H,0120, 241350,GHXOWENS810,0992732,,,,,,1555255,,,,,,,,20090828
The value date "+%y%m%d" is being placed before the current value of field[0].
Can somebody help me?
open(IN, "$vPath3$vName5") or die 'Could not open file for reading';
open(OUT, ">$vPath3$vName6") or die 'Could not open file for writing';
foreach $line (<IN>)
{
@field = split(/\,/, $line);
$numb = substr($field[10],0,1); # first digit of number
$find = $field[1];
$fond = $field[19];
chomp($date = 'date "+%y%m%d"');
$line =~ s/^$fond/$date/;
if ($numb == 1) # PO number starts with a 1
{
$line =~ s/$find/0120/;
print OUT $line;
}
This is working to find the first digit of the PO number and insert the company number into field 1.
Field 19 is blank and I am trying into insert today's date in the YYYYMMDD format.
The result is
date "+%y%m%d"H,0120, 241350,GHXOWENS810,0992732,,,,,,1555255,,,,,,,,20090828
The value date "+%y%m%d" is being placed before the current value of field[0].
Can somebody help me?