in reply to Regex & reading from filehandles
open $readhandle, "<", "Input.log"; open $writehandle, ">", "Output.log";
You should always verify that the files opened correctly:
open my $readhandle, '<', 'Input.log' or die "Cannot open 'Input.log +' $!"; open my $writehandle, '>', 'Output.log' or die "Cannot open 'Output.lo +g' $!";
while(<$readhandle>) { $line = readline($readhandle);
You are reading the first line into $_ and then reading the second line into $line so you only ever deal with half the lines in the file. You probably want to work with every line of the file, like this:
while ( my $line = <$readhandle> ) {
$line = ~/(.)\n/;
You are assigning the bitwise negation of the match operator to $line.   It looks like you intended to use the binding operator (=~) instead although that expression would then be in void context and would not modify or output anything.
|
|---|