[bcn-pm] Expresiones regulares.

Alex Muntada alexm at cpan.org
Tue Apr 12 04:06:17 PDT 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

* TooManySecrets <toomany at toomany.net>:
  [2005-04-12 11:52:09 +0200]

> > perl -pe '$_=(join " ",(split /\s+/)[reverse 0..4])."\n"'
> 
> Me miraré qué hace para intentar comprenderlo antes de usarlo.

@columnes = 0 .. 4;                 # d'1 a 5 però des de 0
@senmuloc = reverse @columnes;      # columnes invertides

while (<>) {
    @elements = split /\s+/, $_;    # $_ és opcional
    $sortida = join " ", @elements[@senmuloc];

    print $sortida, "\n";
}

- --
Alex Muntada <alexm at alexm.org>
http://alexm.org/

-----BEGIN PGP SIGNATURE-----

iD8DBQFCW6uaLdxCGS3zaBERAq6PAJ968P6t9pmqBpI9O2cz6kWoFiCFnwCg1WSq
pCR6ms2A3zFv6Gjg+MNT1wk=
=2TMh
-----END PGP SIGNATURE-----


More information about the Barcelona-pm mailing list