My first Text Editor <HELP>

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";
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,184
Messages
2,570,978
Members
47,578
Latest member
LC_06

Latest Threads

Top