If you could help me with another problem I encountered in this program I would be very grateful. I want to enter the number of columns, only once for all the files, not for every file. My original code is:
while (my $line = <$original_fh>) { print "Enter the desired number of columns: "; my $nr = <STDIN>; chomp($nr); $line =~ s/((\w\w\t){$nr})/$1\n/g; $line =~ s/\t/,/g; $line =~ s/(\d{2})/$replace[$1]/g; print $final_fh $line; }
and I tried something like this unsuccessfully
while (my $line = <$original_fh>) { for my $file (@files) { print "Enter the desired number of columns: "; my $nr = <STDIN>; chomp($nr); $line =~ s/((\w\w\t){$nr})/$1\n/g; } $line =~ s/\t/,/g; $line =~ s/(\d{2})/$replace[$1]/g; print $final_fh $line; }
In reply to Re^4: Read from multiple files change the data with a script and the write the respective output files with a different extension
by Akatsuki
in thread Read from multiple files change the data with a script and the write the respective output files with a different extension
by Akatsuki
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |