Annotation of loncom/html/adm/help/tex/Variables_in_Scripts.tex, revision 1.4
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: \$variable2~=~\$variable~+~2;
7:
8: Now there is a variable called \texttt{\$variable2} with the the number {}``5''
9: as its value.
10:
11: Variables can also be used in \emph{strings}\index{strings}, which are a
12: sequence of letters. The underlying language of the script, Perl, has a very
13: large number of ways of using variables in strings, but the easiest and most
14: common way is to use normal double-quotes and just spell out the name of
15: the variable you want to use in the string, like this:
16:
1.3 bowersj2 17: \$stringVar~=~{}``I~have~a~variable~with~the~value~\$variable.'';
1.1 bowersj2 18:
19: This will put the string {}``I have a variable with the value 3.'' into
20: the variable named {}``stringVar''.
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>