Hi I am trying to get to values on each line of a text file and write to another file
I am still new to this I tried to writing the following below
Just to let you know i am still a newbie.
I am still new to this I tried to writing the following below
Just to let you know i am still a newbie.
Code:
#!/usr/bin/perl user warnings; use strict; use Fcntl; $OD = "filehandle"; $filepath = "myorders.txt"; my @line = open(OD, $FilePath) or die "file could not be opened"; $line = <OD>; print $line; close OD; for $line (<OD>){ $i = "1"; $a = ($line); #This is how the line looks like#### # Line 1 contains:# # D300[U]02115964[/U]000080000200US NXLS0000000148883200701102007010900000000000000[U]05[/U] - 00000000 20061345000000001USA 000000.05 NN 00000000 # # I am trying to get what is underlined# $info = 'substr($a 5 6 7 8 9 10 11 12)'; print "$info"; $quantity = 'substr($a 80 81)'; print "$quantity" sysopen(HTML, 'myvalues.txt', O_RDWR|O_EXCL|O_CREAT, 0755); printf HTML "$info" "$quantity \n" close(HTML); $i++ };
Comment