[SP-pm] Separar o primeiro do resto

Lucas Moraes lucastiagodemoraes at gmail.com
Tue Apr 30 15:41:16 PDT 2013


com regex você faz isso
m{(\d{1})(\d{1,})}s;
$1, $2


Em 30 de abril de 2013 19:37, Tiago Peczenyj <tiago.peczenyj em gmail.com>escreveu:

> 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
>  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/713dc33c/attachment-0001.html>


More information about the SaoPaulo-pm mailing list