in reply to Re^2: Short version of database push for multiple variables
in thread Short version of database push for multiple variables
BTW, AFAICT, split /\t/ on two consecutive tabs wouldn't return undef, but rather '' (the empty string):
$ perl -MData::Dumper -e'@a = split /\t/, "foo\t\tbar"; print Dumper \ +@a' $VAR1 = [ 'foo', '', 'bar' ];
So the whole "//" thing is moot anyway. It wouldn't even work:
$ perl -MData::Dumper -e'@a = map $_//"NA", split /\t/, "foo\t\tbar"; +print Dumper \@a' $VAR1 = [ 'foo', '', 'bar' ];
In other words, you probably want:
$ perl -MData::Dumper -e'@a = map $_ ne "" ? $_ : "NA", split /\t/, "f +oo\t\tbar"; print Dumper \@a' $VAR1 = [ 'foo', 'NA', 'bar' ];
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Short version of database push for multiple variables
by Anonymous Monk on May 13, 2012 at 20:59 UTC | |
by jwkrahn (Abbot) on May 15, 2012 at 23:25 UTC |