Annotation of loncom/html/adm/help/tex/Variables_in_Scripts.tex, revision 1.3

1.2       bowersj2    1: \label{Variables_in_Scripts}
1.1       bowersj2    2: 
                      3: Variables can be used later in the same script. For instance, we can add
                      4: another line below the \texttt{\$variable} line as such:
                      5: 
                      6: \begin{lyxcode}
                      7: \$variable2~=~\$variable~+~2;
                      8: \end{lyxcode}
                      9: 
                     10: Now there is a variable called \texttt{\$variable2} with the the number {}``5''
                     11: as its value. 
                     12: 
                     13: Variables can also be used in \emph{strings}\index{strings}, which are a
                     14: sequence of letters. The underlying language of the script, Perl, has a very
                     15: large number of ways of using variables in strings, but the easiest and most
                     16: common way is to use normal double-quotes and just spell out the name of
                     17: the variable you want to use in the string, like this:
                     18: 
                     19: \begin{lyxcode}
1.3     ! bowersj2   20: \$stringVar~=~{}``I~have~a~variable~with~the~value~\$variable.'';
1.1       bowersj2   21: \end{lyxcode}
                     22: 
                     23: This will put the string {}``I have a variable with the value 3.'' into
                     24: the variable named {}``stringVar''.

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>