in reply to Re^3: adding lines at specific addresses
in thread adding lines at specific addresses
Then, I test for each LABEL from LABEL O 0 to LABEL O 255. If the label exists, write it to another file, adding the new instructions. If it doesn't exist, just write the new instructions:my @lines = (<>); my $text = join "", @lines;
I tried Tie::File, but couldn't get my head around it. And everything I tried with it was incredibly slow, so I went back to the brute-force approach... Thanks for all your help!!if ($text =~ m/( \(LABEL O 1\))(\n.+?)( \(STOP\)\n)/s) { $labelo1 = $1; $labelo1instructions = $2; print "$labelo1\n NEWLIGINSTRUCTIONS HERE$labelo1instructions"; } else { print "(LABEL O 1)\n NEWLIGINSTRUCTIONS HERE\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: adding lines at specific addresses
by graff (Chancellor) on Oct 11, 2005 at 12:37 UTC | |
by pindar (Initiate) on Oct 12, 2005 at 06:29 UTC | |
by graff (Chancellor) on Oct 12, 2005 at 06:56 UTC | |
by pindar (Initiate) on Oct 13, 2005 at 11:19 UTC |