M
Marc Girod
Hello,
I know this has been explained earlier... but why are map and grep
behaving differently here?
#!/usr/bin/perl -w
use strict;
use feature qw(say);
my @glb = qw(lbtype:FFF);
say $_ for map { s/^lbtype.*)(\@.*)?$/$1/ } @glb;
@glb = qw(lbtype:FFF);
say $_ for grep { s/^lbtype.*)(\@.*)?$/$1/ } @glb;
Running this gives:
$ /tmp/foo
1
FFF
Thanks,
Marc
I know this has been explained earlier... but why are map and grep
behaving differently here?
#!/usr/bin/perl -w
use strict;
use feature qw(say);
my @glb = qw(lbtype:FFF);
say $_ for map { s/^lbtype.*)(\@.*)?$/$1/ } @glb;
@glb = qw(lbtype:FFF);
say $_ for grep { s/^lbtype.*)(\@.*)?$/$1/ } @glb;
Running this gives:
$ /tmp/foo
1
FFF
Thanks,
Marc