#!/usr/bin/env perl -w#
print "Press w to write.\n Press q to quit\n";#
while (my $userinp = ) {#
chomp $userinp;#
open(FILE, '>>', 'myfile.txt');#
while ($userinp ne "q") {#
my $usi = ;#
chomp $usi;#
print FILE $usi;#
print "Success - if this statecomes it should mean succes.\n";#
if ($usi eq "q") {#
close FILE;#
die("You have decided to kill this program\n");#
}#
}#
}#