in reply to map not returning

You have several problems.

Your also backwacking more than is necessary. Putting that all together we get

my $params = "'196', 'berg',NULL,NULL"; my @list_of_params = map { $_ eq 'NULL' ? undef : $_ } map { s/^'(\d+?)'$/$1/m; $_ } split /\s*,\s*/, $params ;

It's probably not the way I would have done it, but it does correct some errors and produce the output you want.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller
If I understand your problem, I can solve it! Of course, the same can be said for you.

Replies are listed 'Best First'.
Re: Re: map not returning
by ctilmes (Vicar) on Sep 11, 2003 at 11:18 UTC
    You don't really need two maps, just put both statements in one map:
    my $params = "'196', 'berg',NULL,NULL"; my @list_of_params = map { s/^'(\d+?)'$/$1/m; $_ eq 'NULL' ? undef : $_ } split /\s*,\s*/, $params;