#!/usr/bin/perl -p chomp; my ($a, $b, $c, @out); $a = oct $_; do { $b = $a & 7; $b ^= 1; $c = $a >> $b; $b ^= 5; $b ^= $c; $a >>= 3; push @out, $b & 7; } while $a; $_ .= ' -> ' . join(',', @out) . "\n\n";