in reply to returning scalar context from map or grep

Parentheses around the arguments to my provide list context :

perl -le "my ($first) = grep {/bar/} (qw(foo bar baz)); print $first"

Note please, that I'm not exactly sure whether the parentheses on the left side induce the list context though - others will most likely correct me.

perl -MHTTP::Daemon -MHTTP::Response -MLWP::Simple -e ' ; # The $d = new HTTP::Daemon and fork and getprint $d->url and exit;#spider ($c = $d->accept())->get_request(); $c->send_response( new #in the HTTP::Response(200,$_,$_,qq(Just another Perl hacker\n))); ' # web

Replies are listed 'Best First'.
Re: Re: returning scalar context from map or grep
by broquaint (Abbot) on Apr 28, 2003 at 13:20 UTC
    Note please, that I'm not exactly sure whether the parentheses on the left side induce the list context though
    That they do, the my() isa lvalue list assignment with only one element in said list.
    HTH

    _________
    broquaint