Sure - sorry for being too cryptic. Sometimes it's hard to tell how much detail is needed. :-)
Insert a new line as follows (code snippet taken from your OP):
while (<>) {
next if m/^\s+$/; # <-- add this line
my @cellen = ( split /,/, )[ 3, 4 ];
The regex is anchored to the start (^) and end ($) of the string, and the pattern consists of one or more white space characters (\s+). See perlre and Pattern Matching, Regular Expressions, and Parsing (in the Tutorials section) for more information.
Incidently, the code I added is a bit shorter than it could be, since it utilizes $_. A more verbose version could be:
next if $_ =~ m/^\s+$/;
or, if you wanted to explicitly assign the input text to a variable before processing, you could do something like this:
while ( my $line = <>) {
next if $line =~ m/^\s+$/; # <-- add this line
my @cellen = ( split( /,/, $line ) )[ 3, 4 ];
HTH
|