note rjt <p>Your first example could be reduced to:</p> <c>#!/usr/bin/perl system('tail -F chatlog.txt');</c> <p>As you might imagine, you don't need a Perl script to run a one-line shell command.</p> <p>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 <c>system("read $in")</c> won't go anywhere. <c>read(1)</c> 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.</p> <p>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 [doc://open], [doc://print], and [doc://perlop#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.</p> <p>Finally, twice you have used this construct:</p> <c>$on = "true"; while ($on = "true") { ... } </c> <p>There are two problems with this. First, your condition for [doc://perlsyn#Compound-Statements|while], <c>$on = "true"</c> will <b>always</b> evaluate to TRUE. This is because you are <b>assigning</b> the value <c>"true"</c> to the variable <c>$on</c> every time through the loop, and the assignment operator returns the value assigned. Since you are comparing strings, you would want to use <c>$on eq 'true'</c> to do what you want, which is compare the value of <c>$on</c> to the string <c>'true'</c>. (If you were comparing numbers, you would use <c>==</c> instead of <c>eq</c>).</p> <p>Second, you actually don't need this clumsy construct and extra variable at all. You could equivalently write:</p> <c>while (1) { ... }</c> <p>Or, probably, once you get the hang of <c><></c>, something like below, but don't highlight the text below if you want to figure this out on your own:</p> <spoiler> <c>while (<>) { print $fh $_; }</c> </spoiler> <p>Keep at it, though. It gets logarithmically easier the more you learn. :-)</p> 1003711 1003711