use strict; use warnings; use Quantum::Superpositions; use Test::More qw/no_plan/; \$|++; my %corr = ( a => any( 'a', '@', '4' ), b => any( 'b', '6', '8', '&' ), d => any( 'd', '0' ), e => any( 'e', '3', '&' ), g => any( 'g', '9' ), i => any( 'i', '1', 'l' ), j => any( 'j', '1' ), l => any( 'l', '1' ), o => any( 'o', '0' ), p => any( 'p', '9' ), q => any( 'q', '9' ), s => any( 's', '\$', '5' ), t => any( 't', '+' ), z => any( 'z', '2', '7', '%' ) ); sub compare_strings { my \$s1 = shift; my \$s2 = shift; my @c1 = split //, lc \$s1; my @c2 = split //, lc \$s2; @c2 = map { exists \$corr{ \$_ } ? \$corr{ \$_ } : \$_ } @c2; print "c1: @c1\nc2: @c2\n"; my \$res = 1; for ( my \$index = 0; \$index < scalar @c1; \$index++ ) { \$res = \$res && (\$c1[ \$index ] eq \$c2[ \$index ]); } return \$res; } ok( 'a' eq any( '4', 'a', '@' ) ); ok( compare_strings( 'l4rsen', 'larsen' ) ); ok( compare_strings( 'b4rsen', 'larsen' ) ); ok( compare_strings( 'b4rsen', 'larsen' ) ); ok( compare_strings( 'm@rc0m4r0n91u', 'marcomarongiu' ) );