use strict;
use warnings;
use Number::Spell;
my $input = q(<foo>111</foo>
<foo>44</foo>
<foo>3333</foo>
<foo></foo>
<foo>555</foo>);
$input =~ s|<(?:/)?foo>||g;
@array = split '\n', $input;
my $i = 1;
foreach (@array) {
print spell_number($i)."\t$_\n";
$i++;
}
__END__
my $i = 0;
my %hash = map { s|<(?:/)?foo>||g; spell_number($i++) => $_}
split "\n", $input;
print "$_\t$hash{$_}\n" foreach (sort keys %hash);
use Number::Spell;
$input =~ s|<(?:/)?foo>||g;
my @lines = split "\n", $input; # grep for blank lines
my $i = 0;
my %hash = map { spell_number($i++) => $_ } @lines;
No comments:
Post a Comment