summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordakkar <dakkar@luxion>2008-08-08 10:11:39 +0000
committerdakkar <dakkar@luxion>2008-08-08 10:11:39 +0000
commit21a0f9b706b59afc537bfe56603e91b633d2af4e (patch)
tree96214fa30e60af6d3f0bc81baae3d78553e4f972
parentqualche altra pagina (diff)
downloadintro-perl-21a0f9b706b59afc537bfe56603e91b633d2af4e.tar.gz
intro-perl-21a0f9b706b59afc537bfe56603e91b633d2af4e.tar.bz2
intro-perl-21a0f9b706b59afc537bfe56603e91b633d2af4e.zip
variabili, i/o
git-svn-id: svn://luxion/repos/intro-perl@350 fcb26f47-9200-0410-b104-b98ab5b095f3
-rw-r--r--corso.content.tex52
1 files changed, 52 insertions, 0 deletions
diff --git a/corso.content.tex b/corso.content.tex
index 0dddf50..e42f822 100644
--- a/corso.content.tex
+++ b/corso.content.tex
@@ -350,8 +350,60 @@ Stringhe racchiuse tra virgolette doppie:
\end{itemize}
\end{frame}
+\begin{frame}[fragile]\frametitle{Dichiarazioni}
+\begin{lstlisting}
+use strict;
+use warnings;
+
+my $a;my ($b,$c);
+\end{lstlisting}
+\end{frame}
+%$
+
+\subsection{Interpolazione}
+
+\begin{frame}[fragile]\frametitle{Interpolazione}
+Stringhe tra virgolette doppie {\em interpolano} le variabili:
+
+\begin{itemize}
+\item \lstinline!$quanti=12;$msg="Totale: $quanti pezzi"! \visible<2->{$\rightarrow$ \lstinline!Totale: 12 pezzi!}
+\item \lstinline!$msg="Totale: \$quanti pezzi"! \visible<2->{$\rightarrow$ \lstinline!Totale: $quanti pezzi!}
+\item \lstinline!$misura=7.5;$etichetta="${misura}cm"! \visible<2->{$\rightarrow$ \lstinline!7.5cm!}
+\end{itemize}
+\end{frame}
+
\subsection{Input/Output} % print, <>, chomp
+\begin{frame}[fragile]\frametitle{Scrivere}
+\begin{lstlisting}
+print "Buh!\n";
+my $a='qualcosa';print $a,"\n";
+print "a","b","c";
+\end{lstlisting}
+
+\visible<2->{%
+\lstinline/Buh!/\\
+\lstinline!qualcosa!\\
+\lstinline!abc!}
+\end{frame}
+
+\begin{frame}[fragile]\frametitle{Leggere}
+\begin{lstlisting}
+my $riga=<>; # legge una riga
+\end{lstlisting}
+
+\visible<2->{Il valore letto {\em include} il carattere di ``a capo''}
+\end{frame}
+
+\begin{frame}[fragile]\frametitle{\texttt{chomp}}
+\begin{lstlisting}
+my $riga=<>; # legge una riga, con \n alla fine
+chomp($riga);
+\end{lstlisting}
+
+Adesso \lstinline!$riga! non contiene pił il carattere di ``a capo''
+\end{frame}
+
\subsection{\texttt{if} e \texttt{while}} % else, elsif
\subsection{Valori particolari} % undef, true/false, defined