Hello
I need to read some data in a file and add in another file part of the
line with some changes

input data
./data01;data02;data03;data04;data05;data06;data07;
./data11;data12;data13;data14;data15;data16;data17;
./data21;data22;data23;data24;data25;data26;data27;
./data31;data32;data33;data34;data35;data36;data37;

out put data need
can be like zis

data01;data02;data03;data01_sametexttoall;data04
data11;data12;data03;data11_sametexttoall;data14
data21;data22;data23;data21_sametexttoall;data24
data31;data32;data33;data31_sametexttoall;;data34

out data can be also

./data01;data02;data03;data01_sametexttoall;data04
./data11;data12;data03;data11_sametexttoall;data14
./data21;data22;data23;data21_sametexttoall;data24
./data31;data32;data33;data31_sametexttoall;;data34

I have tryed this but not not working some error "Global symbol "@f"
requires explicit package name" I am using activeperl if I need to add
some pach please tell me what is this because I add all filesys and
same error

my code is this but not working :(

use strict;
use warnings;


# GET a value for accout.txt and outaccount
my $OUTPUTFILE ="acounts.txt";
my $ACC_FILE = "outaccounts.txt";

#open input file
open my $ACC_IN "<", $ACC_FILE
    or die "Cannot open '$ACC_FILE' for reading - $!;

#split by line
  while (my $line = <ACC_IN>)

 { @F = split(';' $line);
chomp ($line);
#open output file
open $OUTPUTFILE;
#print value what is interested for me in the file and then go to the
next line
print {$OUTPUTFILE}
"$f[0]",'/',"$f[1]",'/',"$f[2]","$f[0]","$f[3]"\n";
#close outfile
close $OUTPUTFILE;
}


-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/


Reply via email to