my @in = qw( Bu1s5ter Mi6mi Roscoe Gin98ger El123la );
my @out = map { s/\d+//g } @in;
print "in: @in\nout: @out\n";
#OUTPUT
#in: Buster Mimi Roscoe Ginger Ella
#out: 2 1 1 1
my @in = qw( Bu1s5ter Mi6mi Roscoe Gin98ger El123la );
my @out = map { my $s = $_; $s =~ s/\d+//g; $s } @in;
print "in: @in\nout: @out\n";
#OUPTUT
#in: Bu1s5ter Mi6mi Roscoe Gin98ger El123la
#out: Buster Mimi Roscoe Ginger Ella
SOURCE: http://www.effectiveperlprogramming.com/blog/659
No comments:
Post a Comment