hossman has asked for the wisdom of the Perl Monks concerning the following question:
This is one of those weird little things that I figured would make more sense to me in the morning ... but it's not. I'm sure I'm overlooking something silly.
I'm splitting a string in such a way that lots of the 'fields' are empty. At first i thought these would come back as empty strings (ie: ''), but evidently I was wrong -- they're undefiend...
bester:~> perl -Mstrict -Mwarnings -le 'print "defined!" if defined( ( +split /\//, "2|3|||||")[4]);' bester:~>
No big deal, I'll just use map to convert the undefs -- or maybe not...
bester:~> perl -Mstrict -Mwarnings -le 'print "defined!" if defined( ( +map { defined($_) ? $_ : ""; } (split /\//, "2|3|||||") )[4]);' bester:~>
This is when i decided it was time to get some sleep, but looking at it in the sunlight, I'm still not seeing my problem.
ideas?
|
|---|