Warning: preg_replace(): Compilation failed: escape sequence is invalid in character class at offset 4 in /home/customer/www/theunixtips.com/public_html/wp-content/plugins/resume-builder/includes/class.resume-builder-enqueues.php on line 59

perl : Remove empty lines from an array

Using grep the empty lines can be removed from an array in perl. Here is how.

### Remove any empty lines
@dataArray = grep(/S/, @dataArray);


S does the pattern matching that if everything on that line is a space.

 

2 Comments

Comments are closed.