gurpreetsingh13 has asked for the wisdom of the Perl Monks concerning the following question:
perl -e 'use v5.14;$a=3456; my @all=split (//,$a);print "Yes" if 3 ~~ +@all;'
I want to eliminate that @all array there. It might be possible using 'grep' or 'any' or 'regex' or any of those List utility type modules. But is there any way I can simply impose a list context on split function.perl -e 'use v5.14;$a=3456; print "Yes" if 3 ~~ split (//,$a);'
Any ARRAY smartmatch each ARRAY element[ 3] like: grep { Any ~~ $_ } ARRAY
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using smartmatch with split function
by Athanasius (Archbishop) on May 26, 2014 at 07:55 UTC | |
by trizen (Hermit) on May 26, 2014 at 09:18 UTC | |
by gurpreetsingh13 (Scribe) on May 26, 2014 at 09:01 UTC | |
|
Re: Using smartmatch with split function
by boftx (Deacon) on May 26, 2014 at 16:35 UTC |