A
atbusbook
use strict;
open(IN,"$ARGV[0]");
open(OUT,">$ARGV[0]");
our @file = <IN>;
for(@file){
our $file .= $_;
}
for(;{
print ": ";
my $cmd = <>;
if($cmd =~ /(\d+) a/){
my @lines = <>;
my $linenum = $1;
for(@lines){
our $lines .= $_;
}
@file = split(/\n/,$file);
$file[$linenum] .= $lines;
$file = "@file";
$file =~ s/\n /\n/;
}
elsif($cmd=~/w/){
print OUT "$file\n";
}
}
open(IN,"$ARGV[0]");
open(OUT,">$ARGV[0]");
our @file = <IN>;
for(@file){
our $file .= $_;
}
for(;{
print ": ";
my $cmd = <>;
if($cmd =~ /(\d+) a/){
my @lines = <>;
my $linenum = $1;
for(@lines){
our $lines .= $_;
}
@file = split(/\n/,$file);
$file[$linenum] .= $lines;
$file = "@file";
$file =~ s/\n /\n/;
}
elsif($cmd=~/w/){
print OUT "$file\n";
}
}