nix, shell, perl, php, mysql and mac os x tips and tricks

Saturday, August 5, 2017

Array: remove empty, remove whitespace out of each slice

For dealing with arrays with IDs (that have been touched by humans somewhere along the way)
@array = grep /\S/, @array; # remove empty
s/\s$// for @array; # remove whitespace out of each slot