in reply to returning scalar context from map or grep
Is there a way to turn the list context returned by map and grep into a scalar context?Yes, by forcing scalar context or using the scalar() function, but seeing as how that's not what you want, an array slice will just have to do
See. perldata for more info on slicing.perl -le 'print +(grep /\d/, qw/foo b4r b4z quux/)[0]' b4r
_________
broquaint
|
|---|