Daniel,<br><br>O shift com um array você já entendeu, certo? Então, três informações adicionais:<br><ol><li>O shift sem um argumento vai usar o array "default", @_, que, no corpo de código principal vai conter os parâmetros passados ao seu script, no corpo de uma função vai conter os parâmetros passados à função, e no corpo do Exú-Caolho vai conter a lista de mandingas ofertadas.</li>
<li>O shift (array explícito ou no default, tanto faz) vai retornar como valor o primeiro item da lista, aquele que foi removido da mesma. Ou seja, o trecho:<br><br>$item = shift;<br><br>Remove o primeiro item do array default e o atribui ao scalar $item.</li>
<li>Diretamente da man page perlfunc(1):<br><br> shift ARRAY<br> shift Shifts the first value of the array off and returns it, short‐<br> ening the array by 1 and moving everything down. If there are<br>
no elements in the array, returns the undefined value. If<br> ARRAY is omitted, shifts the @_ array within the lexical scope<br> of subroutines and formats, and the @ARGV array at file scopes<br>
or within the lexical scopes established by the "eval ''",<br> "BEGIN {}", "INIT {}", "CHECK {}", and "END {}" constructs.<br><br> See also "unshift", "push", and "pop". "shift" and "unshift"<br>
do the same thing to the left end of an array that "pop" and<br> "push" do to the right end.<br><br>então, RTFM :-)<br></li></ol> []s,<br>Russo<br><br><div class="gmail_quote">
2008/6/10 Daniel de Oliveira Mantovani <<a href="mailto:daniel.oliveira.mantovani@hotmail.com">daniel.oliveira.mantovani@hotmail.com</a>>:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>
Pessoas, queria me desculpar com vocês por atitudes imaturas.<br>Sei que tenho muito o que aprender, principalmente sobre Perl, e não existe lugar melhor para o aprendizado, do que com os Mestres Dobradores de Perl.<br>Espero recuperar a elegância natural de um newbie.<br>
E espero recuperar isso com atitudes e perguntas construtivas.<br>Para começar eu não intendi a utilidade do shift quando usado junto à uma variável,<br>Exemplo:<br>$variavel = shift;<br>e também não intendi a utilidade do "My"<br>
Exemplo:<br>my $variavel = shift;<br>O My eu sei teoricamente o que ele faz, o shift eu sei usar ele perfeitamente com "Array", para retirar o primeiro argumento, porém o shift com variável e o My, na prática eu não intendi muito bem, pois como eu já disse é a minha primeira linguagem de programação.<br>
Gostaria que me mostrassem programas simples com shift junto à uma variável, e o My, sei que simples para vocês é dificilimo para mim, então pesso que escolham com cuidado.<br><br>Obrigado.<br><br>Abraços a todos.<br><font color="#888888"><br>
Daniel Mantovani<br></font><div class="WgoR0d"><br><hr>Notícias direto do New York Times, gols do Lance, videocassetadas e muitos outros vídeos no MSN Videos! <a href="http://video.msn.com/?mkt=pt-br" target="_blank">Confira já!</a></div>
</div>
<br>_______________________________________________<br>
SaoPaulo-pm mailing list<br>
<a href="mailto:SaoPaulo-pm@pm.org">SaoPaulo-pm@pm.org</a><br>
<a href="http://mail.pm.org/mailman/listinfo/saopaulo-pm" target="_blank">http://mail.pm.org/mailman/listinfo/saopaulo-pm</a><br></blockquote></div><br><br clear="all"><br>-- <br>Alexei Znamensky [russoz_gmail_com] [<a href="http://russoz.wordpress.com">russoz.wordpress.com</a>] [<a href="http://www.flickr.com/photos/alexeiz">www.flickr.com/photos/alexeiz</a>]<br>
"Though we live in trying times, we're the ones who have to try"