in reply to Golf: string complement
my $string = 'abcde'; sub invert { #234567890123456789012345678901234567890 join"",grep/[^\Q$_[0]\E]/,map{chr}1..255 } print invert($string);
UPDATE: Finally, I did it! 37 strokes. :)
my $string = 'defg'; sub invert { #234567890123456789012345678901234567890 join'',grep/[^\Q@_\E]/,map{chr}1..255 } print invert($string);
Dave
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re:^2 Golf: string complement
by cLive ;-) (Prior) on May 15, 2004 at 23:27 UTC | |
by BrowserUk (Patriarch) on May 15, 2004 at 23:38 UTC | |
by cLive ;-) (Prior) on May 16, 2004 at 00:56 UTC | |
by BrowserUk (Patriarch) on May 16, 2004 at 01:23 UTC | |
by davido (Cardinal) on May 16, 2004 at 03:51 UTC | |
by japhy (Canon) on May 16, 2004 at 01:23 UTC |