]> git.vpit.fr Git - perl/modules/autovivification.git/blobdiff - samples/hash2array.pl
Plain dereferencing shouldn't have a different behaviour
[perl/modules/autovivification.git] / samples / hash2array.pl
index 72cd2657ee2c1c689e85442bbca1f77b20d68330..863ba885721a1de1c42bc9929d4b51426a34f76b 100644 (file)
@@ -37,10 +37,12 @@ while (<$hash_t>) {
   $in_data = 1;
   print $array_t $_;
  } elsif (!$in_data) {
-  s{s/\^\$/%/}{s/^\$/@/};
+  s{'%'}{'\@'};
   print $array_t $_;
  } else {
+  s!(\ba\b)?(\s*)HASH\b!($1 ? 'an': '') . "$2ARRAY"!eg;
   s!->{([a-z])}!'->[' . num($1) . ']'!eg;
+  s!%(\{?)\$!\@$1\$!g;
   my $buf;
   my $suffix = $_;
   my ($bracket, $prefix);