SPUG: Petty perl obfuscation question
Brian Ingerson
ingy at ttul.org
Sat Oct 12 14:09:22 CDT 2002
On 12/10/02 03:48 -0700, Andrew Sweger wrote:
> Assuming well formed input, this seems to work:
>
> $string = "Prefix-3C2B1A";
> $string =~ s/(?<=-).+/join'',sort$&=~m{(..)}g/e;
$string =~ s!(?<=-).+!join'',sort$&=~/(..)/g!e;
Good stuff Andy. I can't seem to knock it down by more than a stroke.
I tried to lose the join as well, but to no avail. Sort doesn't seem to
do anything in scalar context, as the manpage confirms.
Cheers, Brian
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
Subscriptions; Email to majordomo at pm.org: ACTION LIST EMAIL
Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest
Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org
More information about the spug-list
mailing list