Ejercicio: Identificadores entre LLaves
  
En general, en un contexto en el que se espera un identificador de
variable, Perl interpreta un identificador entre llaves como 
una cadena literal. Explique la conducta de Perl
ante el siguiente código:
lhp@nereida:~/Lperl/src/testing$ cat -n shift.pl
     1  use strict;
     2
     3  my @puf = (1..10);
     4  toto(\@puf);
     5
     6  sub toto {
     7    my @a = @{shift};
     8    print "@a\n";
     9  }
lhp@nereida:~/Lperl/src/testing$ perl -c shift.pl
Global symbol "@shift" requires explicit package name at shift.pl line 7.
shift.pl had compilation errors.
¿Que ocurre si sustituimos la lınea 5 por my @a = @{shift()};?
Casiano Rodríguez León

Principios de Programación Imperativa, Funcional y Orientada a Objetos Una Introducción en Perl/Una Introducción a Perl
por Casiano Rodríguez León 
is licensed under a Creative Commons Reconocimiento 3.0 Unported License.
Permissions beyond the scope of this license may be available at http://campusvirtual.ull.es/ocw/course/view.php?id=43.
2012-06-19