Skip to content

Instantly share code, notes, and snippets.

@neontorrent
Created March 9, 2016 06:47
Show Gist options
  • Save neontorrent/652d1e3e58e7b20c22bc to your computer and use it in GitHub Desktop.
Save neontorrent/652d1e3e58e7b20c22bc to your computer and use it in GitHub Desktop.
use warnings;
use strict;
$_ = 'abcdefghi';
# s/./ substr $_, -$+[0], 1 /eg; # duh, substr and array
# s#.# /(.).{$-[0]}$/; $1 #eg; # duh, array
my $x = 0; s#.# /(.).{$x}$/; $x++; $1 #eg;
print "$_\n";
my @a = split //, shift;
print "INPUT = <@a>";
# @a[0..$#a] = @a[map -1-$_, 0..$#a];
@a[$_,~$_] = @a[~$_,$_] for 0..$#a/2;
print "OUTPUT = <@a>";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment