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:
or, if you wanted to explicitly assign the input text to a variable before processing, you could do something like this:next if $_ =~ m/^\s+$/;
while ( my $line = <>) { next if $line =~ m/^\s+$/; # <-- add this line my @cellen = ( split( /,/, $line ) )[ 3, 4 ];
HTH
In reply to Re^3: Split pattern doesn't match last line of file
by bobf
in thread Split pattern doesn't match last line of file
by GertMT
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |