Thread in array suchen (4 answers)
Opened by Strazke at 2005-08-26 01:41

J-jayz-Z
 2005-08-26 01:58
#57385 #57385
User since
2005-04-13
625 Artikel
BenutzerIn
[Homepage] [default_avatar]
jo, mit map
Code: (dl )
1
2
map { print "jo" if $_ =~ /foo/ } @bar;
@new = map { "$_" if $_ =~ /foo/ } @bar;

oder mit grep:
Code: (dl )
@new = grep { /foo/ } @bar;
\n\n

<!--EDIT|J-jayz-Z|1125009154-->
perl -Mstrict -Mwarnings -e 'package blub; sub new { bless {} } sub bar {my $self=shift; $self->{bla}="5065726c2d436f6d6d756e697479"; return $self->{bla};} my $foo=blub->new();print "Hallo ";print pack("H*",$foo->bar()); print "\n"'

http://perl-tutor.de

View full thread in array suchen