+my $rawdata = readline;
+my ($id, $subid) = (substr($rawdata, 0, 15), ord substr($rawdata, 15, 1));
+my $version = $opt{version} // $MAGICID{$id}
+ or die "File does not match any known WormEdit level header\n";
+$subid == $version
+ or warn "Unsupported version $subid (expecting $version)\n";
+given ($version) {
+ when (53) {
+ # current @FORMAT
+ }
+ when ($_ <= 95 and $_ > 90) {
+ ref $_ and pop @$_ for @{ $FORMAT[11] }; # only 8 moderefs
+ $FORMAT[-1]->[-1]->[0] = '32C'; # less objects
+ continue;
+ }
+ when (95) {
+ $FORMAT[7] = 'Ca64'; # no reserved space after description
+ #ref $_ and $_->[-1] = 'C' for @{ $FORMAT[11] }; # only 9 moderefs
+ $FORMAT[19] = 'Ca255'; # enddata
+ splice @FORMAT, 6, 2 if $subid < 95; # early (sub)version without description
+ }
+ when ($_ <= 94 and $_ > 90) {
+ splice @FORMAT, 6, 2; # no description
+ splice @{ $FORMAT[7] }, 4, 2; # no race
+ splice @FORMAT, 16, 2; # no enddata
+ splice @{ $FORMAT[-1] }, 1, 2; # no name
+ continue if $_ < 94;
+ }
+ when (93) {
+ splice @FORMAT, 16, 2; # no hiname
+ $FORMAT[-1]->[0] = 64; # constant amount of levels
+ }
+ default {
+ die "Cannot parse data for Wormedit $version\n";
+ }
+}
+my @rawdata = unpack Shiar_Parse::Nested->template(\@FORMAT).'a*', $rawdata;