File:  [LON-CAPA] / loncom / html / adm / help / tex / Variables_in_Scripts.tex
Revision 1.4: download - view: text, annotated - select for diffs
Fri Oct 12 13:26:55 2012 UTC (11 years, 9 months ago) by raeburn
Branches: MAIN
CVS tags: version_2_11_0_RC1, HEAD
- Remove lyxcode

    1: \label{Variables_in_Scripts}
    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: 
   17: \$stringVar~=~{}``I~have~a~variable~with~the~value~\$variable.'';
   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>