As you might imagine, you don't need a Perl script to run a one-line shell command.

Your second example isn't syntactically valid (unbalanced quotes), but that may have just been a copy/paste error. However, the more serious problem is that system("read $in") won't go anywhere. read(1) assigns its result to shell variables (Bash, in your case). No process (including Perl) can access shell variables from a subshell, at least not without some additional effort.

There is a pure Perl way to do what you want to do (in both cases). For the second case, I suggest you look at the Perl documentation for open, print, and I/O Operators, for a basic way to open a text file for append ('>>'), accept lines of input from a user and print those lines to your text file.

There are two problems with this. First, your condition for while, $on = "true" will always evaluate to TRUE. This is because you are assigning the value "true" to the variable $on every time through the loop, and the assignment operator returns the value assigned. Since you are comparing strings, you would want to use $on eq 'true' to do what you want, which is compare the value of $on to the string 'true'. (If you were comparing numbers, you would use == instead of eq).

Second, you actually don't need this clumsy construct and extra variable at all. You could equivalently write:

while (1) { ... }

Or, probably, once you get the hang of <>, something like below, but don't highlight the text below if you want to figure this out on your own:

When putting a smiley right before a closing parenthesis, do you:

Use two parentheses: (Like this: :) )
Use one parenthesis: (Like this: :)
Reverse direction of the smiley: (Like this: (: )
Use angle/square brackets instead of parentheses
Use C-style commenting to set the smiley off from the closing parenthesis
Make the smiley a dunce: (:>
I disapprove of emoticons
Other