X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=samples%2Fhash2array.pl;h=4e7ccaa032da344682be0a7ace71b58c2fdef2c8;hb=0c37aa6a52c733eb61895b9c95054e5e2f689ede;hp=b26950a272eb343c311d2aea274e634965ff51e1;hpb=2966b83e4eb41f8bd7f8c354e078bce07ced1fea;p=perl%2Fmodules%2Fautovivification.git diff --git a/samples/hash2array.pl b/samples/hash2array.pl index b26950a..4e7ccaa 100644 --- a/samples/hash2array.pl +++ b/samples/hash2array.pl @@ -37,7 +37,7 @@ while (<$hash_t>) { $in_data = 1; print $array_t $_; } elsif (!$in_data) { - s{s/\^\$/%/}{s/^\$/@/}; + s{'%'}{'\@'}; print $array_t $_; } else { s!->{([a-z])}!'->[' . num($1) . ']'!eg; @@ -49,6 +49,7 @@ while (<$hash_t>) { } $buf .= $suffix; $buf =~ s/\s+/ /g; + $buf =~ s/\s+$//; print $array_t "$buf\n"; } }