function return in scalar context

sub lowercase {
    return map { lc } @_ ;

$jim = lowercase('jim') ;
print "$jim\n" ;

Naturally that this snippet of code prints 1. I understand the explanation of "an array in scalar context blah blah blah". But it's so counter-intuitive because many functions are intended to mutate each element in a list. Presumably one should define separate functions depending on whether an array is expected, but that's so non-perlish. There's no elegant way to throw the wantarray operator in that example function. And even if there was, it's awkward to use the same idiom repeatedly.

I'd prefer simply to use a pragma such as the following:

use Function::ReturnScalar qw( first ) ;

## use Function::ReturnScalar qw( last ) ;      # optional alternative

## use Function::ReturnScalar qw( count ) ;   # optional alternative

sub lowercase {
    return map { lc } @_ ;

$jim = lowercase('Jim') ;                                  # $jim == 'jim'

The pragmas in the above example don't exist. At least, even after posting on perlmonks, I can't find anything equivalent. But in a couple of hours, I wrote a rudimentary module that performs this function.

JQuery and Moose

In the spirt of re-usability, I'm sharing something I posted elsewhere last week:

The context is that recruiters are pressuring older programmers to learn JQuery (read Community College class) and I'm also wondering whether to rewrite a few apps that I maintain.

MVC - A Personal History

I shared this story with a potential employer a couple weeks ago, who apparently was unimpressed. Notwithstanding, it's all true. Literary criticism might be the next best step.

In 2001, Arthur Andersen Business Consulting went out of business. And I lost the best job I ever had. Clearly Enron was a significant factor, but importantly, AABC ran out of money to fund their war with Andersen Consulting/Accenture. Almost immediately, I was contacted by a friend/colleague, Jeff: He was launching a startup and needed an IT Director. Essentially, my job was to develop the tec…

There used to be a And after Stevan Little's keynote last week, Perl- The Detroit of Scripting Languages, I made some inquiries about resurrecting it... Maybe specifically with the intention of hosting YAPC :).

So far, the local response has been positive. As long as I don't step on any toes here. In so many ways, Perl and Detroit are the best of all possible worlds.

Austin Question