my $psolution = [qw( a8 c7 e8 g7 h5 f6 d7 b8 c6 a7 c8 e7 g8 h6 f7 d8 e6 f8 h7 g5 h3 f4 d5 b6 c4 a5 b7 d6 f5 h4 g2 e3 g4 h2 f3 g1 e2 d4 b5 a3 b1 c3 a4 b2 d1 f2 h1 g3 f1 d2 e4 c5 a6 b4 a2 c1 b3 a1 c2 e1 d3 e5 g6 h8 )]; my $pboard = { }; map { show_solution($_, $pboard) } @$psolution;