[SP-pm] Separar o primeiro do resto

Lindolfo Rodrigues lorn at lornlab.org
Tue Apr 30 15:40:06 PDT 2013


Não pode transformar em um array?  

perl -MData::Printer -e '$x="12345"; @foo = split//, $x; p @foo'

[
    [0] 1,
    [1] 2,
    [2] 3,
    [3] 4,
    [4] 5
]


--  
Lorn


On Tuesday, April 30, 2013 at 7:37 PM, Tiago Peczenyj wrote:

> Seguinte: tenho X bytes como
> $x="12345"
> E quero pegar o primeiro e o resto:
> ($a,$b) = magica $x;
> $a = 1
> $b = 2345  
> Comofas?
> Eu posso fazer bytes::substr 2 vezes mas ta feio...
>  
> =begin disclaimer
> Sao Paulo Perl Mongers: http://sao-paulo.pm.org/
> SaoPaulo-pm mailing list: SaoPaulo-pm em pm.org (mailto:SaoPaulo-pm em pm.org)
> L<http://mail.pm.org/mailman/listinfo/saopaulo-pm>
> =end disclaimer
>  
>  


-------------- Pr�xima Parte ----------
Um anexo em HTML foi limpo...
URL: <http://mail.pm.org/pipermail/saopaulo-pm/attachments/20130430/e0b201c4/attachment-0001.html>


More information about the SaoPaulo-pm mailing list