Hi,

Please be patient with this beginner. I have a subrouting as follows,
that prints out an ASCII representation of chess board

sub display_board {
        foreach (0..7) {
                my $ref = @_[$_];
                foreach (0..7) {
                        my $piece = $ref->[$_];
                        $piece =~ /.*(..$)/;
                        print $pieces{$1};
                }
                print "\n";
        }
};

It works, but is there a way of combining these lines:

                        my $piece = $ref->[$_];
                        $piece =~ /.*(..$)/;

It feels like this could be done in one step. Is this correct? I'm
finding that I'm doing alright in Perl, but I sense the Perl urge to do
things in as few a number of steps as possible.

Thanks,
Richard Hobson

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to