develooper Front page | perl.perl6.users | Postings from September 2020

Re: Any other way to do this

Thread Previous | Thread Next
Brian Duggan
September 1, 2020 15:27
Re: Any other way to do this
Message ID:
On Monday, August 31, Bruce Gray wrote: 
> I finally settled on using `try` instead of numeric coercion, because
> if I am not golfing, I think `try` makes the grep look more like
> “filter out the non-numbers” instead of “get rid of the zero values”.

Another option is to use 'val' -- which parses it as a literal --

  $ raku -e 'say @* { val($_) ~~ Numeric }' 1 2 3 a 1e10
   (True True True False True)


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About