for( $self->{gamedescr}{Game} ) { while( ! m/\G\z/mgc ) { if( m/\G($REnumber)\s*/mgc ) { my $num=$1; #... } elsif( m/\G($REanymove)\s*/mgc ) { push @{$self->{GameMoves}}, $1; $color = $switchcolor{$color}; } elsif( m/\G($REcomment|$REeolcomment|$RERAV|$RENAG|$REescape)\s*/mgc ) { #... } else { die "Invalid input..."; } } }