Re: Simple way to Reverse an Array
- From: anno4000@xxxxxxxxxxxxxxxxxxxxxxx (Anno Siegel)
- Date: 6 Feb 2006 14:23:44 GMT
Dr.Ruud <rvtol+news@xxxxxxxxxxxx> wrote in comp.lang.perl.misc:
Dr.Ruud:
A. Sinan Unur:
A. Sinan Unur <1usa@xxxxxxxxxxxxxxxxxxx>
(reverse each component and remove .invalid for email address)
echo 'cba@xxxxxxxxxxxxxxx' \
| perl -ple '@_=/(\w+|.)/g;pop@_,pop@_;$_=reverse@_=reverse@_'
| perl -ple 'split/(\W)/;pop@_;pop@_;$_=reverse@_=reverse@_'
| perl -ple 's/\.[^.]+$//;s/(\w+)/reverse$1/eg'
Much more pedestrian, but shorter is shorter.
Anno, who used to say he doesn't do golf.
--
If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers.
.
- Follow-Ups:
- Re: Simple way to Reverse an Array
- From: Dr.Ruud
- Re: Simple way to Reverse an Array
- References:
- Simple way to Reverse an Array
- From: Bill H
- Re: Simple way to Reverse an Array
- From: A. Sinan Unur
- Re: Simple way to Reverse an Array
- From: Dr.Ruud
- Re: Simple way to Reverse an Array
- From: Dr.Ruud
- Simple way to Reverse an Array
- Prev by Date: Re: Morse code audio playout?
- Next by Date: SOAP::Lite example meets http server 500 error?
- Previous by thread: Re: Simple way to Reverse an Array
- Next by thread: Re: Simple way to Reverse an Array
- Index(es):
Relevant Pages
|